From 201ccaeea50835e325d63f3732f497c838bf43f7 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 8 Sep 2025 14:11:49 +0300 Subject: [PATCH] feat(profile): enhance user role checks in subscription and links components - Added conditional rendering in SubscriptionInfoBar and LinksCard to hide components for users with the Client role. - Updated ProfileDataCard to use Enum_Customer_Role for role management. - Improved error handling in OrdersService to differentiate between master and client order limit errors. --- apps/web/components/orders/order-form/index.tsx | 2 +- apps/web/components/profile/data-card/index.tsx | 10 ++++++---- apps/web/components/profile/links-card/index.tsx | 7 +++++++ apps/web/components/profile/subscription-bar.tsx | 7 +++++++ packages/graphql/api/orders.ts | 8 ++++++-- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/apps/web/components/orders/order-form/index.tsx b/apps/web/components/orders/order-form/index.tsx index ec670f9..0a0216a 100644 --- a/apps/web/components/orders/order-form/index.tsx +++ b/apps/web/components/orders/order-form/index.tsx @@ -1,7 +1,7 @@ 'use client'; import { BackButton } from './back-button'; -import { InvitedGrid, InvitedByGrid } from './contacts-grid'; +import { InvitedByGrid, InvitedGrid } from './contacts-grid'; import { DateTimeSelect } from './datetime-select'; import { NextButton } from './next-button'; import { ErrorPage, SuccessPage } from './result'; diff --git a/apps/web/components/profile/data-card/index.tsx b/apps/web/components/profile/data-card/index.tsx index 6b76717..e719780 100644 --- a/apps/web/components/profile/data-card/index.tsx +++ b/apps/web/components/profile/data-card/index.tsx @@ -1,9 +1,11 @@ +/* eslint-disable canonical/id-match */ 'use client'; import { type ProfileProps } from '../types'; -import { TextField } from '@/components/shared/data-fields'; +import { CheckboxWithText, TextField } from '@/components/shared/data-fields'; import { CardSectionHeader } from '@/components/ui'; import { useCustomerMutation, useCustomerQuery } from '@/hooks/api/customers'; +import { Enum_Customer_Role } from '@repo/graphql/types'; import { Button } from '@repo/ui/components/ui/button'; import { Card } from '@repo/ui/components/ui/card'; import Link from 'next/link'; @@ -49,14 +51,14 @@ export function ProfileDataCard() { value={customer?.name ?? ''} /> - {/* - updateField('role', checked ? Role.Master : Role.Client) + updateField('role', checked ? Enum_Customer_Role.Master : Enum_Customer_Role.Client) } text="Быть мастером" - /> */} + /> {hasChanges && (