add navigation
add pages structure temp disable telegram provider
This commit is contained in:
parent
847107866e
commit
8169685d6a
3
apps/web/app/(main)/dashboard/page.tsx
Normal file
3
apps/web/app/(main)/dashboard/page.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
export default function DashboardPage() {
|
||||
return 'Dashboard';
|
||||
}
|
||||
11
apps/web/app/(main)/layout.tsx
Normal file
11
apps/web/app/(main)/layout.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import { BottomNav } from '@/components/navigation';
|
||||
import { type PropsWithChildren } from 'react';
|
||||
|
||||
export default async function Layout({ children }: Readonly<PropsWithChildren>) {
|
||||
return (
|
||||
<div className="min-h-screen">
|
||||
<main>{children}</main>
|
||||
<BottomNav />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
3
apps/web/app/(main)/masters/page.tsx
Normal file
3
apps/web/app/(main)/masters/page.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
export default function MastersPage() {
|
||||
return 'Masters';
|
||||
}
|
||||
5
apps/web/app/(main)/page.tsx
Normal file
5
apps/web/app/(main)/page.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default async function Profile() {
|
||||
redirect('/dashboard');
|
||||
}
|
||||
8
apps/web/app/(main)/profile/page.tsx
Normal file
8
apps/web/app/(main)/profile/page.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
'use client';
|
||||
import { initData, useSignal } from '@telegram-apps/sdk-react';
|
||||
|
||||
export default function ProfilePage() {
|
||||
const initDataState = useSignal(initData.state);
|
||||
|
||||
return JSON.stringify(initDataState, null, 2);
|
||||
}
|
||||
3
apps/web/app/(main)/records/add/page.tsx
Normal file
3
apps/web/app/(main)/records/add/page.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
export default function AddRecordsPage() {
|
||||
return 'Add Records';
|
||||
}
|
||||
3
apps/web/app/(main)/records/page.tsx
Normal file
3
apps/web/app/(main)/records/page.tsx
Normal file
@ -0,0 +1,3 @@
|
||||
export default function RecordsPage() {
|
||||
return 'Records';
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
import { Root } from '@/components/telegram';
|
||||
// import { Root as TelegramRoot } from '@/components/telegram';
|
||||
import { I18nProvider } from '@/utils/i18n/provider';
|
||||
import { type Metadata } from 'next';
|
||||
import { getLocale } from 'next-intl/server';
|
||||
import '@repo/ui/globals.css';
|
||||
import { type PropsWithChildren } from 'react';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@ -16,7 +17,9 @@ export default async function RootLayout({ children }: Readonly<PropsWithChildre
|
||||
<html lang={locale}>
|
||||
<body>
|
||||
<I18nProvider>
|
||||
<Root>{children}</Root>
|
||||
{/* <TelegramRoot> */}
|
||||
{children}
|
||||
{/* </TelegramRoot> */}
|
||||
</I18nProvider>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { initData, isMiniAppDark, useSignal } from '@telegram-apps/sdk-react';
|
||||
|
||||
export default function InitDataPage() {
|
||||
const initDataState = useSignal(initData.state);
|
||||
const isDark = isMiniAppDark();
|
||||
|
||||
return (
|
||||
<code style={{ color: isDark ? 'white' : 'black' }}>
|
||||
{JSON.stringify(initDataState, null, 2)}
|
||||
</code>
|
||||
);
|
||||
}
|
||||
1
apps/web/components/navigation/index.tsx
Normal file
1
apps/web/components/navigation/index.tsx
Normal file
@ -0,0 +1 @@
|
||||
export * from './navbar';
|
||||
26
apps/web/components/navigation/nav-button.tsx
Normal file
26
apps/web/components/navigation/nav-button.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
'use client';
|
||||
import { Button } from '@repo/ui/components/ui/button';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
type NavButtonProps = {
|
||||
readonly href: string;
|
||||
readonly icon: React.ReactNode;
|
||||
readonly label: string;
|
||||
};
|
||||
|
||||
export function NavButton({ href, icon, label }: NavButtonProps) {
|
||||
const pathname = usePathname();
|
||||
return (
|
||||
<Button
|
||||
asChild
|
||||
className="flex flex-col items-center p-6"
|
||||
variant={pathname.endsWith(href) ? 'default' : 'ghost'}
|
||||
>
|
||||
<Link href={href}>
|
||||
<span>{icon}</span>
|
||||
<span className="mt-1 text-xs">{label}</span>
|
||||
</Link>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
16
apps/web/components/navigation/navbar.tsx
Normal file
16
apps/web/components/navigation/navbar.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import { NavButton } from './nav-button';
|
||||
import { BookOpen, Newspaper, PlusCircle, User, Users } from 'lucide-react';
|
||||
|
||||
export function BottomNav() {
|
||||
return (
|
||||
<nav className="fixed inset-x-0 bottom-0 border-t border-border bg-background">
|
||||
<div className="grid grid-cols-5">
|
||||
<NavButton href="/dashboard" icon={<Newspaper />} label="Главное" />
|
||||
<NavButton href="/records" icon={<BookOpen />} label="Записи" />
|
||||
<NavButton href="/records/add" icon={<PlusCircle />} label="Новая запись" />
|
||||
<NavButton href="/masters" icon={<Users />} label="Мастера" />
|
||||
<NavButton href="/profile" icon={<User />} label="Профиль" />
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@ -7,5 +7,8 @@ export default [
|
||||
...tailwindConfig,
|
||||
{
|
||||
ignores: ['**/graphql/types.ts', '**/schema.graphql'],
|
||||
rules:{
|
||||
'react/forbid-component-props':0
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"@repo/ui": "workspace:*",
|
||||
"@telegram-apps/sdk-react": "^2.0.19",
|
||||
"graphql": "catalog:",
|
||||
"lucide-react": "catalog:",
|
||||
"next": "catalog:",
|
||||
"next-intl": "^3.26.0",
|
||||
"react": "catalog:",
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -149,6 +149,9 @@ importers:
|
||||
graphql:
|
||||
specifier: 'catalog:'
|
||||
version: 16.9.0
|
||||
lucide-react:
|
||||
specifier: 'catalog:'
|
||||
version: 0.462.0(react@19.0.0)
|
||||
next:
|
||||
specifier: 'catalog:'
|
||||
version: 15.1.0(@babel/core@7.26.0)(@playwright/test@1.49.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user