diff --git a/apps/web/app/(main)/profile/page.tsx b/apps/web/app/(main)/profile/page.tsx index 47f847a..15ef539 100644 --- a/apps/web/app/(main)/profile/page.tsx +++ b/apps/web/app/(main)/profile/page.tsx @@ -1,5 +1,5 @@ import { getProfile } from '@/actions/profile'; -import { PersonCard, ProfileDataCard } from '@/components/profile'; +import { LinksCard, PersonCard, ProfileDataCard } from '@/components/profile'; import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'; export default async function ProfilePage() { @@ -15,6 +15,7 @@ export default async function ProfilePage() {
+
); diff --git a/apps/web/app/(main)/profile/schedule/page.tsx b/apps/web/app/(main)/profile/schedule/page.tsx new file mode 100644 index 0000000..5988505 --- /dev/null +++ b/apps/web/app/(main)/profile/schedule/page.tsx @@ -0,0 +1,3 @@ +export default function SchedulePage() { + return 'Schedule'; +} diff --git a/apps/web/components/profile/cards/components/index.ts b/apps/web/components/profile/cards/components/index.ts index e72c8dd..bbf8904 100644 --- a/apps/web/components/profile/cards/components/index.ts +++ b/apps/web/components/profile/cards/components/index.ts @@ -1,3 +1,4 @@ export * from './card-header'; export * from './checkbox-field'; +export * from './link-button'; export * from './text-field'; diff --git a/apps/web/components/profile/cards/components/link-button.tsx b/apps/web/components/profile/cards/components/link-button.tsx new file mode 100644 index 0000000..489aa25 --- /dev/null +++ b/apps/web/components/profile/cards/components/link-button.tsx @@ -0,0 +1,21 @@ +import Link from 'next/link'; + +type Props = { + readonly description?: string; + readonly href: string; + readonly text: string; + readonly visible?: boolean; +}; + +export function LinkButton({ description, href, text, visible }: Props) { + if (!visible) return null; + + return ( + +
+

{text}

+ {description} +
+ + ); +} diff --git a/apps/web/components/profile/cards/index.ts b/apps/web/components/profile/cards/index.ts index ddd60a4..fd1dd09 100644 --- a/apps/web/components/profile/cards/index.ts +++ b/apps/web/components/profile/cards/index.ts @@ -1,2 +1,3 @@ export * from './data-card'; +export * from './links-card'; export * from './person-card'; diff --git a/apps/web/components/profile/cards/links-card.tsx b/apps/web/components/profile/cards/links-card.tsx new file mode 100644 index 0000000..ddb4303 --- /dev/null +++ b/apps/web/components/profile/cards/links-card.tsx @@ -0,0 +1,27 @@ +/* eslint-disable canonical/id-match */ +'use client'; +import { type ProfileProps } from '../types'; +import { LinkButton } from './components'; +import { getProfile } from '@/actions/profile'; +import { Enum_Customer_Role } from '@repo/graphql/types'; +import { useQuery } from '@tanstack/react-query'; + +export function LinksCard({ telegramId }: Readonly) { + const { data: customer } = useQuery({ + queryFn: () => getProfile({ telegramId }), + queryKey: telegramId ? ['profile', 'telegramId', telegramId] : ['profile'], + }); + + const isMaster = customer?.role === Enum_Customer_Role.Master; + + return ( +
+ +
+ ); +}