Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve navigation around All languages/projects a bit #4

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React from "react";
import { getNileConfig } from "@/static/NileConfig";
import { LayoutCommon } from "@/components/LayoutCommon";
import { ConfigProvider } from "@/providers/ConfigProvider";
import { MainPage } from "./MainPage";

export default async function Home() {
const nileConfig = await getNileConfig();

return (
<main>
<ConfigProvider config={nileConfig}>
<LayoutCommon>
<MainPage />
</LayoutCommon>
</ConfigProvider>
<LayoutCommon>
<MainPage />
</LayoutCommon>
</main>
);
}
40 changes: 34 additions & 6 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,23 @@ export const Header = () => {
)}

{pathname.startsWith("/language/") && (
<Button component={Link} variant="subtle" radius="xl" size="xs" href={`/language/${language.language}`}>
All Projects
</Button>
<Menu>
<Menu.Target>
<Button variant="subtle" radius="xl" size="xs" rightSection={<IconChevronDown size={14} />}>
All projects
</Button>
</Menu.Target>
<Menu.Dropdown>
<Menu.Item component={Link} href={`/language/${language.language}`}>
All projects
</Menu.Item>
{Object.keys(config.projects ?? {}).map((key) => (
<Menu.Item key={key} component={Link} href={`/translation/${key}/${language.language}`}>
{config.projects?.[key]?.name ?? ""}
</Menu.Item>
))}
</Menu.Dropdown>
</Menu>
)}

{pathname.startsWith("/language/") && (
Expand Down Expand Up @@ -80,9 +94,23 @@ export const Header = () => {
)}

{pathname.startsWith("/project/") && (
<Button component={Link} variant="subtle" radius="xl" size="xs" href={`/project/${project.project}`}>
All languages
</Button>
<Menu>
<Menu.Target>
<Button variant="subtle" radius="xl" size="xs" rightSection={<IconChevronDown size={14} />}>
All languages
</Button>
</Menu.Target>
<Menu.Dropdown>
<Menu.Item component={Link} href={`/project/${project.project}`}>
All languages
</Menu.Item>
{Object.keys(config.languages ?? {}).map((key) => (
<Menu.Item key={key} component={Link} href={`/translation/${project.project}/${key}`}>
{config.languages?.[key]?.name ?? ""} ({key})
</Menu.Item>
))}
</Menu.Dropdown>
</Menu>
)}

{(pathname.startsWith("/translation/") || pathname.startsWith("/string/")) && (
Expand Down
Loading