feat: conditionally render services list based on customer role
- Added a check to prevent rendering the ReadonlyServicesList component for users with the 'Client' role, ensuring a tailored experience based on user permissions.
This commit is contained in:
parent
a1af00af69
commit
b517519e7e
@ -1,3 +1,4 @@
|
||||
/* eslint-disable canonical/id-match */
|
||||
'use client';
|
||||
|
||||
import { type ProfileProps } from '../types';
|
||||
@ -5,13 +6,17 @@ import { DataNotFound } from '@/components/shared/alert';
|
||||
import { ServiceCard } from '@/components/shared/service-card';
|
||||
import { useCustomerQuery } from '@/hooks/api/customers';
|
||||
import { useServicesQuery } from '@/hooks/api/services';
|
||||
import { Enum_Customer_Role } from '@repo/graphql/types';
|
||||
import { LoadingSpinner } from '@repo/ui/components/ui/spinner';
|
||||
import Link from 'next/link';
|
||||
|
||||
// Компонент для отображения услуг мастера (без ссылок, только просмотр)
|
||||
export function ReadonlyServicesList({ telegramId }: Readonly<ProfileProps>) {
|
||||
const { data: { customer } = {} } = useCustomerQuery({ telegramId });
|
||||
const { isLoading, services } = useServices(telegramId);
|
||||
|
||||
if (customer?.role === Enum_Customer_Role.Client) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-2 px-4">
|
||||
<h1 className="font-bold">Услуги</h1>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user