Skip to content

Commit f7a8b94

Browse files
Merge pull request #98 from oleksandriia-it-team/feature/fin-022-parts/sidebar-and-lookups
Feature/fin 022 parts/sidebar and lookups
2 parents d9ae7e8 + 4113607 commit f7a8b94

41 files changed

Lines changed: 1203 additions & 13 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "next build",
1010
"start": "next start",
1111
"database:migrate": "tsx src/server/database/migrate.ts",
12-
"lint": "next lint && prettier --write 'src/**/*.scss' && stylelint 'src/**/*.scss' --fix",
12+
"lint": "next lint && prettier --write \"src/**/*.scss\" && stylelint \"src/**/*.scss\" --fix",
1313
"test": "vitest",
1414
"database:init": "tsx src/server/database/init.ts -- --synchronize=true",
1515
"docker:run": "docker-compose up -d",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { CountriesLookup } from '@frontend/features/admin/countries-lookup/countries-lookup';
2+
3+
export default function CountriesPage() {
4+
return <CountriesLookup />;
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { CurrenciesLookup } from '@frontend/features/admin/currencies-lookup/currencies-lookup';
2+
3+
export default function CurrenciesPage() {
4+
return <CurrenciesLookup />;
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from 'next/navigation';
2+
3+
export default function LookupsPage() {
4+
redirect('/admin/lookups/countries');
5+
}

src/app/(admin)/layout.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { ChildrenComponentProps } from '@frontend/shared/models/component-with-chilren.model';
2+
import { AuthGuard } from '@frontend/entities/profile/auth-guard';
3+
import { RoleGuard } from '@frontend/entities/profile/role-guard';
4+
import { AdminSidebar } from '@frontend/widgets/admin-sidebar/admin-sidebar';
5+
import { AuthorizedUserProvider } from '@frontend/entities/profile/authorized-user.hook';
6+
7+
export default function AdminLayout({ children }: ChildrenComponentProps) {
8+
return (
9+
<AuthGuard>
10+
<RoleGuard>
11+
<AuthorizedUserProvider>
12+
<div className="flex h-full w-full overflow-hidden">
13+
<AdminSidebar />
14+
<main className="flex-1 overflow-auto bg-background">{children}</main>
15+
</div>
16+
</AuthorizedUserProvider>
17+
</RoleGuard>
18+
</AuthGuard>
19+
);
20+
}

src/app/(auth)/login/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import { UiSpinner } from '@frontend/ui/ui-spinner/spinner';
1212
import { FinControlledPassword } from '@frontend/components/controlled-fields/fin-controlled-password';
1313
import { FinControlledInput } from '@frontend/components/controlled-fields/fin-controlled-input';
1414
import { AuthTemplate } from '@frontend/entities/auth/auth-template';
15-
import { useUserInformation } from '@frontend/shared/services/user-information/use-user-information.store';
1615
import { LogoSvg } from '@frontend/shared/svg/logo-svg';
16+
import { useUserInformation } from '@frontend/shared/services/user-information/use-user-information.store';
1717

1818
export default function LoginPage() {
1919
const refreshUser = useUserInformation((state) => state.refresh);
2020

2121
const router = useRouter();
22-
const { methods, submit, isLoading } = useSetupLogin(() => {
23-
refreshUser();
22+
const { methods, submit, isLoading } = useSetupLogin(async () => {
23+
await refreshUser();
2424
router.push('/profile');
2525
});
2626

src/app/(auth)/login/shared/login-form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { fetchClient } from '@frontend/shared/services/fetch-client/fetch-client
66
import { type LoginResponse } from '@common/domains/auth/models/responses/login.response';
77
import { type ApiResultOperation } from '@common/models/api-result-operation.model';
88

9-
export function useSetupLogin(onSuccessAction: () => void) {
9+
export function useSetupLogin(onSuccessAction: () => void | Promise<void>) {
1010
const { mutate, isPending } = useSendDataFetch(
1111
async (data: LoginDto) =>
1212
await fetchClient.post<ApiResultOperation<LoginResponse>>('/api/auth/login', data, { skipAuth: true }),

src/app/(profile)/profile/budget/(regular-operations)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

3-
import { RegularIncomesExpensesProvider } from '@frontend/features/regular-incomes-expenses/card-creation-form/regular-transaction.hook';
43
import type { ChildrenComponentProps } from '@frontend/shared/models/component-with-chilren.model';
4+
import { RegularIncomesExpensesProvider } from '@frontend/features/regular-incomes-expenses/card-creation-form/regular-transaction.hook';
55

66
export default function RegularOperationsLayout({ children }: ChildrenComponentProps) {
77
return <RegularIncomesExpensesProvider>{children}</RegularIncomesExpensesProvider>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { type ReactNode } from 'react';
2+
3+
export interface LookupColumnDef<T> {
4+
header: string;
5+
cell: (item: T) => ReactNode;
6+
headerClassName?: string;
7+
cellClassName?: string;
8+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { UiGraphic } from '@frontend/ui/ui-graphic/ui-graphic';
2+
import { type LookupCreatedBy } from './lookup-created-by.model';
3+
4+
interface LookupCreatedByCellProps {
5+
createdBy: LookupCreatedBy;
6+
}
7+
8+
export function LookupCreatedByCell({ createdBy }: LookupCreatedByCellProps) {
9+
if (!createdBy.name) {
10+
return <span className="text-sm text-muted-foreground"></span>;
11+
}
12+
13+
return (
14+
<div className="flex items-center gap-2">
15+
{createdBy.avatar ? (
16+
<UiGraphic
17+
src={createdBy.avatar}
18+
alt={createdBy.name}
19+
size={20}
20+
className="rounded-full"
21+
/>
22+
) : (
23+
<span className="inline-flex h-5 w-5 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground">
24+
{createdBy.name.charAt(0).toUpperCase()}
25+
</span>
26+
)}
27+
<span className="text-sm text-muted-foreground">{createdBy.name}</span>
28+
</div>
29+
);
30+
}

0 commit comments

Comments
 (0)