-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(frontend): menu and profile refactor (#100)
- Loading branch information
Showing
20 changed files
with
269 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { LanguageSwitcher } from '~/components/language-switcher'; | ||
import { Menu } from '~/components/menu'; | ||
import { UserButton } from '~/components/user-button'; | ||
|
||
interface AppBarProps { | ||
children: React.ReactNode; | ||
name?: string; | ||
profileItems?: React.ReactNode; | ||
} | ||
|
||
export function AppBar({ children, name, profileItems }: AppBarProps) { | ||
const { t } = useTranslation(['gcweb']); | ||
|
||
return ( | ||
<div className="bg-slate-700"> | ||
<div className="align-center container mx-auto flex flex-wrap justify-between"> | ||
<div className="align-center flex"> | ||
<Menu>{children}</Menu> | ||
</div> | ||
<div className="flex items-center space-x-4 text-right"> | ||
{name && <UserButton name={name}>{profileItems}</UserButton>} | ||
<LanguageSwitcher>{t('gcweb:language-switcher.alt-lang')}</LanguageSwitcher> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { RouteHandle } from 'react-router'; | ||
|
||
import { useTranslation } from 'react-i18next'; | ||
|
||
import type { Route } from './+types/request'; | ||
|
||
import { requireAuth } from '~/.server/utils/auth-utils'; | ||
import { getFixedT } from '~/i18n-config.server'; | ||
import { handle as parentHandle } from '~/routes/protected/layout'; | ||
|
||
export const handle = { | ||
i18nNamespace: [...parentHandle.i18nNamespace, 'protected'], | ||
} as const satisfies RouteHandle; | ||
|
||
export async function loader({ context, request }: Route.LoaderArgs) { | ||
requireAuth(context.session, new URL(request.url), ['user']); | ||
const t = await getFixedT(request, handle.i18nNamespace); | ||
return { documentTitle: t('protected:index.page-title') }; | ||
} | ||
|
||
export function meta({ data }: Route.MetaArgs) { | ||
return [{ title: data.documentTitle }]; | ||
} | ||
|
||
export default function Request() { | ||
const { t } = useTranslation(handle.i18nNamespace); | ||
|
||
return ( | ||
<div className="mb-8"> | ||
<h2 className="mt-8 text-xl">{t('gcweb:app.form')}</h2> | ||
<hr className="my-4 text-slate-700" /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.