Skip to content

Commit

Permalink
Merge pull request eclipse-sw360#167 from eclipse-sw360/heliocastro/m…
Browse files Browse the repository at this point in the history
…etadata

feat(metadata): Add root layout metadata
  • Loading branch information
heliocastro authored Oct 31, 2023
2 parents e19fdb9 + 9f2eb5c commit b0a0bb2
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 78 deletions.
2 changes: 1 addition & 1 deletion src/app/[locale]/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const metadata: Metadata = {
title: 'Admin',
}

const Admin = async () => {
async function Admin() {
return <AdminMainPage />
}

Expand Down
4 changes: 3 additions & 1 deletion src/app/[locale]/components/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const metadata: Metadata = {
title: 'Components',
}

export default async function ComponentIndexPage() {
async function ComponentIndexPage() {
return <ComponentIndex />
}

export default ComponentIndexPage
77 changes: 77 additions & 0 deletions src/app/[locale]/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (C) TOSHIBA CORPORATION, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Toshiba Software Development (Vietnam) Co., Ltd., 2023. Part of the SW360 Frontend Project.
// Copyright (C) Siemens AG, 2023. Part of the SW360 Frontend Project.
// Copyright (C) Helio Chissini de Castro, 2023. Part of the SW360 Frontend Project.

// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/

// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

'use client'

import { signOut, useSession } from 'next-auth/react'

import { PageSpinner } from 'next-sw360'

import MyComponentsWidget from './components/MyComponentsWidget'
import MyProjectsWidget from './components/MyProjectsWidget'
import MySubscriptionsWidget from './components/MySubscriptionsWidget'
import MyTaskAssignmentsWidget from './components/MyTaskAssignmentsWidget'
import MyTaskSubmissionsWidget from './components/MyTaskSubmissionsWidget'
import RecentComponentsWidget from './components/RecentComponentsWidget'
import RecentReleasesWidget from './components/RecentReleasesWidget'

function HomePage() {
const { status } = useSession()

if (status === 'unauthenticated') {
signOut()
}

return (
<>
<div className='content-container container-fluid homePage'>
{status == 'loading' ? (
<PageSpinner />
) : (
<div className='row'>
<div className='col col-md-10'>
<div className='row'>
<div className='col-sm' id='sw360_table_col'>
<MyProjectsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<MyComponentsWidget />
</div>
</div>
<div className='row'>
<div className='col-sm' id='sw360_table_col'>
<MyTaskAssignmentsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<MyTaskSubmissionsWidget />
</div>
</div>
</div>
<div className='col col-md-2'>
<div className='col-sm' id='sw360_table_col'>
<MySubscriptionsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<RecentComponentsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<RecentReleasesWidget />
</div>
</div>
</div>
)}
</div>
</>
)
}

export default HomePage
71 changes: 8 additions & 63 deletions src/app/[locale]/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,16 @@
// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

'use client'
import { Metadata } from 'next'

import { useSession } from 'next-auth/react'
import HomePage from './HomePage'

import { PageSpinner } from 'next-sw360'

import MyComponentsWidget from './components/MyComponentsWidget'
import MyProjectsWidget from './components/MyProjectsWidget'
import MySubscriptionsWidget from './components/MySubscriptionsWidget'
import MyTaskAssignmentsWidget from './components/MyTaskAssignmentsWidget'
import MyTaskSubmissionsWidget from './components/MyTaskSubmissionsWidget'
import RecentComponentsWidget from './components/RecentComponentsWidget'
import RecentReleasesWidget from './components/RecentReleasesWidget'

function HomePage() {
const { status } = useSession()

if (status === 'unauthenticated') {
return {
redirect: {
destination: '/',
permanent: false,
},
}
}
export const metadata: Metadata = {
title: 'Home',
}

return (
<div className='content-container container-fluid homePage'>
{status == 'loading' ? (
<PageSpinner />
) : (
<div className='row'>
<div className='col col-md-10'>
<div className='row'>
<div className='col-sm' id='sw360_table_col'>
<MyProjectsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<MyComponentsWidget />
</div>
</div>
<div className='row'>
<div className='col-sm' id='sw360_table_col'>
<MyTaskAssignmentsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<MyTaskSubmissionsWidget />
</div>
</div>
</div>
<div className='col col-md-2'>
<div className='col-sm' id='sw360_table_col'>
<MySubscriptionsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<RecentComponentsWidget />
</div>
<div className='col-sm' id='sw360_table_col'>
<RecentReleasesWidget />
</div>
</div>
</div>
)}
</div>
)
async function Home() {
return <HomePage />
}

export default HomePage
export default Home
18 changes: 14 additions & 4 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@
// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE

import 'bootstrap/dist/css/bootstrap.min.css'
import '@/styles/globals.css'
import '@/styles/auth.css'
import '@/styles/globals.css'
import '@/styles/gridjs/sw360.css'
import 'bootstrap/dist/css/bootstrap.min.css'
import { ReactNode } from 'react'
import { Providers } from '../provider'
import React, { ReactNode } from 'react'

import { Metadata } from 'next'
import { NextIntlClientProvider } from 'next-intl'
import { notFound } from 'next/navigation'

import { Header, Footer } from 'next-sw360'
import { Footer, Header } from 'next-sw360'

export const metadata: Metadata = {
title: {
template: '%s | SW360 Frontend',
default: 'SW360 Frontend',
},
description: 'SW360 Compliance Management System Graphical Interface.',
metadataBase: new URL('https://eclipse.org/sw360/'),
}

export function generateStaticParams() {
return [{ locale: 'en' }, { locale: 'ja' }, { locale: 'vi' }, { locale: 'zh' }, { locale: 'pt-BR' }]
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/app/[locale]/licenses/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
// License-Filename: LICENSE

import { Metadata } from 'next'
import LicenseIndex from './LicenseIndex'
import LicensePage from './LicensePage'

export const metadata: Metadata = {
title: 'Licenses',
}

async function LicensesPage() {
return <LicenseIndex />
async function Licenses() {
return <LicensePage />
}

export default LicensesPage
export default Licenses
4 changes: 3 additions & 1 deletion src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const metadata: Metadata = {
title: 'Welcome - SW360',
}

export default async function AuthPage() {
async function AuthPage() {
return <AuthScreen />
}

export default AuthPage
2 changes: 1 addition & 1 deletion src/app/[locale]/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const metadata: Metadata = {
title: 'Projects',
}

const ProjectsList = async () => {
async function ProjectsList() {
return <Projects />
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const metadata: Metadata = {
title: 'Search',
}

const Vulnerability = async () => {
async function Search() {
return <SearchPage />
}

export default Vulnerability
export default Search
2 changes: 1 addition & 1 deletion src/app/[locale]/vulnerabilities/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const metadata: Metadata = {
title: 'Vulnerabilites',
}

const Vulnerability = async () => {
async function Vulnerability() {
return <Vulnerabilities />
}

Expand Down

0 comments on commit b0a0bb2

Please sign in to comment.