Skip to content

Commit

Permalink
feat(chat): init management route
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Dec 29, 2024
1 parent 0b4ce43 commit fac1e99
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 20 deletions.
10 changes: 9 additions & 1 deletion apps/chat/src/i18n/packs/i18n-lang-en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { I18N_FORWARDED_EN_PACK } from '@llm/ui';
export const I18N_PACK_EN = deepmerge(I18N_FORWARDED_EN_PACK, {
navigation: {
links: {
home: 'Home',
home: 'Chats',
projects: 'Projects',
apps: 'Apps',
experts: 'Experts',
management: 'Management',
},
loggedIn: {
logout: 'Logout',
Expand Down Expand Up @@ -178,6 +179,13 @@ export const I18N_PACK_EN = deepmerge(I18N_FORWARDED_EN_PACK, {
rootOnly: 'This step is only required for root users - regular users are automatically assigned to their organization',
},
},
management: {
meta: {
title: 'Management',
description: 'Management',
},
title: 'Management',
},
},
workspace: {
selectOrganization: 'Select organization',
Expand Down
12 changes: 10 additions & 2 deletions apps/chat/src/i18n/packs/i18n-lang-pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import type { I18nLangPack } from './i18n-packs';
export const I18N_PACK_PL: I18nLangPack = deepmerge(I18N_FORWARDED_PL_PACK, {
navigation: {
links: {
home: 'Strona główna',
home: 'Czaty',
projects: 'Projekty',
apps: 'Aplikacje',
apps: 'Appki',
experts: 'Eksperci',
management: 'Administracja',
},
loggedIn: {
logout: 'Wyloguj się',
Expand Down Expand Up @@ -180,6 +181,13 @@ export const I18N_PACK_PL: I18nLangPack = deepmerge(I18N_FORWARDED_PL_PACK, {
rootOnly: 'Ten krok jest wymagany tylko dla użytkowników root - zwykli użytkownicy są automatycznie przypisani do swojej organizacji',
},
},
management: {
meta: {
title: 'Administracja',
description: 'Zarządzaj ustawieniami organizacji',
},
title: 'Administracja',
},
},
workspace: {
selectOrganization: 'Wybierz organizację',
Expand Down
13 changes: 11 additions & 2 deletions apps/chat/src/layouts/navigation/links/navigation-links.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
FolderKanbanIcon,
GraduationCapIcon,
HomeIcon,
MessageSquareTextIcon,
SettingsIcon,
WandSparklesIcon,
} from 'lucide-react';

Expand All @@ -21,7 +22,7 @@ export function NavigationLinks() {
<ul className="flex items-center gap-4 ml-5">
<NavigationItem
path={sitemap.home}
icon={<HomeIcon size={16} />}
icon={<MessageSquareTextIcon size={16} />}
disabled={!hasOrganization}
>
{t.links.home}
Expand Down Expand Up @@ -50,6 +51,14 @@ export function NavigationLinks() {
>
{t.links.experts}
</StayTunedNavigationItem>

<NavigationItem
path={sitemap.management.index}
icon={<SettingsIcon size={16} />}
disabled={!hasOrganization}
>
{t.links.management}
</NavigationItem>
</ul>
);
}
17 changes: 2 additions & 15 deletions apps/chat/src/layouts/navigation/navigation-right-toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from 'clsx';
import { BellIcon, SearchIcon } from 'lucide-react';
import { SearchIcon } from 'lucide-react';

import { useI18n } from '~/i18n';
import { useHasWorkspaceOrganization } from '~/modules';
Expand All @@ -22,7 +22,7 @@ export function NavigationRightToolbar() {
<input
type="text"
placeholder={t.search.placeholder}
className="focus:border-gray-200 bg-gray-100/80 focus:bg-white py-2 pr-4 pl-10 border border-transparent rounded-full focus:ring-0 w-44 focus:w-64 text-gray-800 text-sm transition-all duration-200 placeholder-gray-500 focus:outline-none"
className="focus:border-gray-200 bg-gray-100/80 focus:bg-white py-2 pr-4 pl-10 border border-transparent rounded-full focus:ring-0 w-44 focus:w-64 text-gray-800 text-sm transition-all duration-200 focus:outline-none placeholder-gray-500"
/>

<SearchIcon
Expand All @@ -31,19 +31,6 @@ export function NavigationRightToolbar() {
/>
</div>

<button
type="button"
disabled={!hasWorkspace}
className={clsx(
'relative hover:bg-gray-100/80 p-3 rounded-full text-gray-800 hover:text-gray-900',
!hasWorkspace && 'pointer-events-none opacity-50',
)}
title={t.notifications.title}
>
<BellIcon size={20} className="relative top-[1px]" />
<span className="top-2 right-2 absolute bg-red-500 rounded-full w-2.5 h-2.5" />
</button>

<ChooseLanguageItem />

<LoggedInUserItem />
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions apps/chat/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ForceRedirectRoute,
HomeRoute,
LoginRoute,
ManagementRoute,
ProjectRoute,
ProjectsRoute,
SettingsRoute,
Expand Down Expand Up @@ -64,6 +65,7 @@ function LoggedInRouter() {
<Route path={sitemap.apps.index} component={AppsRoute} />
<Route path={sitemap.experts} component={ExpertsRoute} />
<Route path={sitemap.settings} component={SettingsRoute} />
<Route path={sitemap.management.index} component={ManagementRoute} />
<Route path={sitemap.forceRedirect.raw} component={ForceRedirectRoute} />

<Route<SdkTableRowWithUuidT> path={sitemap.chat.raw}>
Expand Down
1 change: 1 addition & 0 deletions apps/chat/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './experts';
export * from './force-redirect-route';
export * from './home';
export * from './login';
export * from './management';
export * from './project';
export * from './projects';
export * from './settings';
Expand Down
1 change: 1 addition & 0 deletions apps/chat/src/routes/management/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './management.route';
16 changes: 16 additions & 0 deletions apps/chat/src/routes/management/management.route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { useI18n } from '~/i18n';
import { LayoutHeader, PageWithNavigationLayout } from '~/layouts';
import { RouteMetaTags } from '~/routes';

export function ManagementRoute() {
const t = useI18n().pack.routes.management;
return (
<PageWithNavigationLayout>
<RouteMetaTags meta={t.meta} />

<LayoutHeader>
{t.title}
</LayoutHeader>
</PageWithNavigationLayout>
);
}
3 changes: 3 additions & 0 deletions apps/chat/src/routes/use-sitemap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export function useSitemap() {
login: prefixWithBaseRoute('/login'),
settings: prefixWithBaseRoute('/settings'),
chat: defineSitemapRouteGenerator(prefixWithBaseRoute)('/chat/:id'),
management: {
index: prefixWithBaseRoute('/management/groups'),
},
forceRedirect: {
raw: prefixWithBaseRoute('/force-redirect'),
generate: (targetUrl: string) => pipe(
Expand Down

0 comments on commit fac1e99

Please sign in to comment.