From 27b9b79c60434d557076f5a8c5e1a781515fa0bc Mon Sep 17 00:00:00 2001 From: tlartem Date: Mon, 28 Jul 2025 17:22:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/lib/utils.ts | 6 ++++ {src/component => shared}/ui/alert.tsx | 2 +- {src/component => shared}/ui/badge.tsx | 2 +- {src/component => shared}/ui/button.tsx | 2 +- {src/component => shared}/ui/calendar.tsx | 4 +-- {src/component => shared}/ui/card.tsx | 2 +- {src/component => shared}/ui/checkbox.tsx | 2 +- {src/component => shared}/ui/dialog.tsx | 6 ++-- {src/component => shared}/ui/input.tsx | 2 +- {src/component => shared}/ui/label.tsx | 2 +- {src/component => shared}/ui/popover.tsx | 2 +- {src/component => shared}/ui/radio-group.tsx | 2 +- {src/component => shared}/ui/select.tsx | 4 +-- {src/component => shared}/ui/separator.tsx | 2 +- {src/component => shared}/ui/sidebar.tsx | 8 ++--- {src/component => shared}/ui/textarea.tsx | 2 +- {src/component => shared}/ui/toast.tsx | 0 .../TemplateManager/AutocompleteInput.tsx | 6 ++-- .../CategoryFieldsSelector.tsx | 4 +-- .../TemplateManager/ElementConstructor.tsx | 18 +++++----- .../TemplateManager/ElementFormulaBar.tsx | 2 +- .../TemplateManager/ExcelUploadPanel.tsx | 4 +-- .../TemplateManager/FormattingToolbar.tsx | 4 +-- src/component/TemplateManager/HeaderBar.tsx | 2 +- .../TemplateManager/TemplateFilterSidebar.tsx | 14 ++++---- .../TemplateManager/TemplateManager.tsx | 8 ++--- .../TemplateManager/VisualLayoutEditor.tsx | 12 +++---- .../model/implementations/ButtonGroup.tsx | 4 +-- .../model/implementations/SelectElement.tsx | 16 ++++----- .../StandardsElement/StandardsEditor.tsx | 8 ++--- .../StandardsElement/StandardsPreview.tsx | 4 +-- .../StandardsElement/StandardsSelector.tsx | 20 +++++------ .../StandardsElement/definition.tsx | 6 ++-- .../model/implementations/TextElement.tsx | 4 +-- .../VerificationConditionsEditor.tsx | 10 +++--- .../VerificationConditionsPreview.tsx | 4 +-- .../VerificationConditionsRender.tsx | 22 ++++++------ src/lib/hooks/useToast.tsx | 2 +- src/lib/utils.ts | 8 +---- src/page/standards-management/Page.tsx | 20 +++++------ src/page/templates/Page.tsx | 36 +++++++++---------- src/page/templates/elements/Page.tsx | 2 +- src/page/templates/protocols/Page.tsx | 2 +- src/widget/template/ui/TemplateCard.tsx | 6 ++-- tsconfig.json | 3 +- vite.config.ts | 8 ++--- 46 files changed, 153 insertions(+), 156 deletions(-) create mode 100644 shared/lib/utils.ts rename {src/component => shared}/ui/alert.tsx (98%) rename {src/component => shared}/ui/badge.tsx (96%) rename {src/component => shared}/ui/button.tsx (98%) rename {src/component => shared}/ui/calendar.tsx (98%) rename {src/component => shared}/ui/card.tsx (97%) rename {src/component => shared}/ui/checkbox.tsx (96%) rename {src/component => shared}/ui/dialog.tsx (81%) rename {src/component => shared}/ui/input.tsx (95%) rename {src/component => shared}/ui/label.tsx (94%) rename {src/component => shared}/ui/popover.tsx (96%) rename {src/component => shared}/ui/radio-group.tsx (97%) rename {src/component => shared}/ui/select.tsx (90%) rename {src/component => shared}/ui/separator.tsx (95%) rename {src/component => shared}/ui/sidebar.tsx (98%) rename {src/component => shared}/ui/textarea.tsx (95%) rename {src/component => shared}/ui/toast.tsx (100%) diff --git a/shared/lib/utils.ts b/shared/lib/utils.ts new file mode 100644 index 0000000..d32b0fe --- /dev/null +++ b/shared/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from 'clsx' +import { twMerge } from 'tailwind-merge' + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/src/component/ui/alert.tsx b/shared/ui/alert.tsx similarity index 98% rename from src/component/ui/alert.tsx rename to shared/ui/alert.tsx index 4564b6e..4c13e10 100644 --- a/src/component/ui/alert.tsx +++ b/shared/ui/alert.tsx @@ -1,6 +1,6 @@ -import { cn } from '@/lib/utils' import { cva, type VariantProps } from 'class-variance-authority' import * as React from 'react' +import { cn } from 'shared/lib/utils' const alertVariants = cva( 'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7', diff --git a/src/component/ui/badge.tsx b/shared/ui/badge.tsx similarity index 96% rename from src/component/ui/badge.tsx rename to shared/ui/badge.tsx index cd0069c..1a45264 100644 --- a/src/component/ui/badge.tsx +++ b/shared/ui/badge.tsx @@ -1,7 +1,7 @@ import { cva, type VariantProps } from 'class-variance-authority' import * as React from 'react' -import { cn } from '../../lib/utils' +import { cn } from 'shared/lib/utils' const badgeVariants = cva( 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', diff --git a/src/component/ui/button.tsx b/shared/ui/button.tsx similarity index 98% rename from src/component/ui/button.tsx rename to shared/ui/button.tsx index 0954fd4..9a84359 100644 --- a/src/component/ui/button.tsx +++ b/shared/ui/button.tsx @@ -2,7 +2,7 @@ import { Slot } from '@radix-ui/react-slot' import { cva, type VariantProps } from 'class-variance-authority' import * as React from 'react' -import { cn } from '@/lib/utils' +import { cn } from 'shared/lib/utils' const buttonVariants = cva( 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', diff --git a/src/component/ui/calendar.tsx b/shared/ui/calendar.tsx similarity index 98% rename from src/component/ui/calendar.tsx rename to shared/ui/calendar.tsx index eb9bdc9..d00b08b 100644 --- a/src/component/ui/calendar.tsx +++ b/shared/ui/calendar.tsx @@ -8,8 +8,8 @@ import { import * as React from 'react' import { DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker' -import { Button, buttonVariants } from '@/component/ui/button' -import { cn } from '@/lib/utils' +import { cn } from 'shared/lib/utils' +import { Button, buttonVariants } from './button' function Calendar({ className, diff --git a/src/component/ui/card.tsx b/shared/ui/card.tsx similarity index 97% rename from src/component/ui/card.tsx rename to shared/ui/card.tsx index 547b185..7259b3e 100644 --- a/src/component/ui/card.tsx +++ b/shared/ui/card.tsx @@ -1,6 +1,6 @@ import * as React from 'react' -import { cn } from '@/lib/utils' +import { cn } from 'shared/lib/utils' const Card = React.forwardRef< HTMLDivElement, diff --git a/src/component/ui/checkbox.tsx b/shared/ui/checkbox.tsx similarity index 96% rename from src/component/ui/checkbox.tsx rename to shared/ui/checkbox.tsx index 98a4bad..55df774 100644 --- a/src/component/ui/checkbox.tsx +++ b/shared/ui/checkbox.tsx @@ -1,7 +1,7 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox' import { Check } from 'lucide-react' import * as React from 'react' -import { cn } from '../../lib/utils' +import { cn } from 'shared/lib/utils' const Checkbox = React.forwardRef< React.ElementRef, diff --git a/src/component/ui/dialog.tsx b/shared/ui/dialog.tsx similarity index 81% rename from src/component/ui/dialog.tsx rename to shared/ui/dialog.tsx index f7c59cc..ecb9675 100644 --- a/src/component/ui/dialog.tsx +++ b/shared/ui/dialog.tsx @@ -1,7 +1,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog' import { X } from 'lucide-react' import * as React from 'react' -import { cn } from '../../lib/utils' +import { cn } from 'shared/lib/utils' const Dialog = DialogPrimitive.Root @@ -18,7 +18,7 @@ const DialogOverlay = React.forwardRef< {} diff --git a/src/component/ui/label.tsx b/shared/ui/label.tsx similarity index 94% rename from src/component/ui/label.tsx rename to shared/ui/label.tsx index 1c36f9d..8470e3c 100644 --- a/src/component/ui/label.tsx +++ b/shared/ui/label.tsx @@ -2,7 +2,7 @@ import * as LabelPrimitive from '@radix-ui/react-label' import { cva, type VariantProps } from 'class-variance-authority' import * as React from 'react' -import { cn } from '@/lib/utils' +import { cn } from 'shared/lib/utils' const labelVariants = cva( 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70' diff --git a/src/component/ui/popover.tsx b/shared/ui/popover.tsx similarity index 96% rename from src/component/ui/popover.tsx rename to shared/ui/popover.tsx index 3c9c3df..b60bab5 100644 --- a/src/component/ui/popover.tsx +++ b/shared/ui/popover.tsx @@ -1,6 +1,6 @@ -import { cn } from '@/lib/utils' import * as PopoverPrimitive from '@radix-ui/react-popover' import * as React from 'react' +import { cn } from 'shared/lib/utils' const Popover = PopoverPrimitive.Root const PopoverTrigger = PopoverPrimitive.Trigger diff --git a/src/component/ui/radio-group.tsx b/shared/ui/radio-group.tsx similarity index 97% rename from src/component/ui/radio-group.tsx rename to shared/ui/radio-group.tsx index c4ba4e2..af8a39d 100644 --- a/src/component/ui/radio-group.tsx +++ b/shared/ui/radio-group.tsx @@ -1,7 +1,7 @@ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group' import { Circle } from 'lucide-react' import * as React from 'react' -import { cn } from '../../lib/utils' +import { cn } from 'shared/lib/utils' const RadioGroup = React.forwardRef< React.ElementRef, diff --git a/src/component/ui/select.tsx b/shared/ui/select.tsx similarity index 90% rename from src/component/ui/select.tsx rename to shared/ui/select.tsx index b29c686..b3ca79a 100644 --- a/src/component/ui/select.tsx +++ b/shared/ui/select.tsx @@ -4,7 +4,7 @@ import * as SelectPrimitive from '@radix-ui/react-select' import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react' import * as React from 'react' -import { cn } from '@/lib/utils' +import { cn } from 'shared/lib/utils' function Select({ ...props @@ -61,7 +61,7 @@ function SelectContent({ , diff --git a/src/component/ui/sidebar.tsx b/shared/ui/sidebar.tsx similarity index 98% rename from src/component/ui/sidebar.tsx rename to shared/ui/sidebar.tsx index ce97cb4..1db7d9e 100644 --- a/src/component/ui/sidebar.tsx +++ b/shared/ui/sidebar.tsx @@ -2,10 +2,10 @@ import { Slot } from '@radix-ui/react-slot' import { PanelLeftIcon } from 'lucide-react' import * as React from 'react' -import { Button } from '@/component/ui/button' -import { Input } from '@/component/ui/input' -import { Separator } from '@/component/ui/separator' -import { cn } from '@/lib/utils' +import { cn } from 'shared/lib/utils' +import { Button } from 'shared/ui/button' +import { Input } from 'shared/ui/input' +import { Separator } from 'shared/ui/separator' const SIDEBAR_COOKIE_NAME = 'sidebar_state' const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 diff --git a/src/component/ui/textarea.tsx b/shared/ui/textarea.tsx similarity index 95% rename from src/component/ui/textarea.tsx rename to shared/ui/textarea.tsx index 78118cc..171940b 100644 --- a/src/component/ui/textarea.tsx +++ b/shared/ui/textarea.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { cn } from '../../lib/utils' +import { cn } from 'shared/lib/utils' export interface TextareaProps extends React.TextareaHTMLAttributes {} diff --git a/src/component/ui/toast.tsx b/shared/ui/toast.tsx similarity index 100% rename from src/component/ui/toast.tsx rename to shared/ui/toast.tsx diff --git a/src/component/TemplateManager/AutocompleteInput.tsx b/src/component/TemplateManager/AutocompleteInput.tsx index 6d4722c..52d60fd 100644 --- a/src/component/TemplateManager/AutocompleteInput.tsx +++ b/src/component/TemplateManager/AutocompleteInput.tsx @@ -1,8 +1,8 @@ -import { Button } from '@/component/ui/button' -import { Input } from '@/component/ui/input' -import { Label } from '@/component/ui/label' import { ChevronDown, X } from 'lucide-react' import React, { useEffect, useRef, useState } from 'react' +import { Button } from 'shared/ui/button' +import { Input } from 'shared/ui/input' +import { Label } from 'shared/ui/label' interface AutocompleteInputProps { label: string diff --git a/src/component/TemplateManager/CategoryFieldsSelector.tsx b/src/component/TemplateManager/CategoryFieldsSelector.tsx index b4efb20..648d8d9 100644 --- a/src/component/TemplateManager/CategoryFieldsSelector.tsx +++ b/src/component/TemplateManager/CategoryFieldsSelector.tsx @@ -1,9 +1,9 @@ -import { Input } from '@/component/ui/input' -import { Label } from '@/component/ui/label' import { useCategoryContext } from '@/entity/template/model/CategoryContext' import { Attribute } from '@/type/template' import { AlertCircle } from 'lucide-react' import React from 'react' +import { Input } from 'shared/ui/input' +import { Label } from 'shared/ui/label' interface AttributeValue { attributeId: string diff --git a/src/component/TemplateManager/ElementConstructor.tsx b/src/component/TemplateManager/ElementConstructor.tsx index 3eab68f..d43a57a 100644 --- a/src/component/TemplateManager/ElementConstructor.tsx +++ b/src/component/TemplateManager/ElementConstructor.tsx @@ -23,27 +23,27 @@ import { Type, } from 'lucide-react' import React, { useState } from 'react' -import { v4 as uuidv4 } from 'uuid' -import { Button } from '../ui/button' -import { Card, CardContent, CardHeader, CardTitle } from '../ui/card' -import { Checkbox } from '../ui/checkbox' +import { Button } from 'shared/ui/button' +import { Card, CardContent, CardHeader, CardTitle } from 'shared/ui/card' +import { Checkbox } from 'shared/ui/checkbox' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, -} from '../ui/dialog' -import { Input } from '../ui/input' -import { Label } from '../ui/label' +} from 'shared/ui/dialog' +import { Input } from 'shared/ui/input' +import { Label } from 'shared/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from '../ui/select' -import { Separator } from '../ui/separator' +} from 'shared/ui/select' +import { Separator } from 'shared/ui/separator' +import { v4 as uuidv4 } from 'uuid' import { ElementFormulaBar } from './ElementFormulaBar' import { VisualLayoutEditor } from './VisualLayoutEditor' diff --git a/src/component/TemplateManager/ElementFormulaBar.tsx b/src/component/TemplateManager/ElementFormulaBar.tsx index cfae5f2..638ec20 100644 --- a/src/component/TemplateManager/ElementFormulaBar.tsx +++ b/src/component/TemplateManager/ElementFormulaBar.tsx @@ -1,6 +1,6 @@ import { Eye, EyeOff, Magnet, Plus, Save, Wrench } from 'lucide-react' import { memo } from 'react' -import { Button } from '../ui/button' +import { Button } from 'shared/ui/button' interface ElementFormulaBarProps { elementCount: number diff --git a/src/component/TemplateManager/ExcelUploadPanel.tsx b/src/component/TemplateManager/ExcelUploadPanel.tsx index 658d741..7ee1d10 100644 --- a/src/component/TemplateManager/ExcelUploadPanel.tsx +++ b/src/component/TemplateManager/ExcelUploadPanel.tsx @@ -1,7 +1,7 @@ -import { Button } from '@/component/ui/button' -import { Popover, PopoverContent, PopoverTrigger } from '@/component/ui/popover' import { FileText, Upload } from 'lucide-react' import React, { useRef } from 'react' +import { Button } from 'shared/ui/button' +import { Popover, PopoverContent, PopoverTrigger } from 'shared/ui/popover' interface ExcelUploadPanelProps { fileName?: string diff --git a/src/component/TemplateManager/FormattingToolbar.tsx b/src/component/TemplateManager/FormattingToolbar.tsx index 69a57b2..d4c8578 100644 --- a/src/component/TemplateManager/FormattingToolbar.tsx +++ b/src/component/TemplateManager/FormattingToolbar.tsx @@ -1,5 +1,3 @@ -import { Button } from '@/component/ui/button' -import { Separator } from '@/component/ui/separator' import { AlignCenter, AlignLeft, @@ -12,6 +10,8 @@ import { Underline, } from 'lucide-react' import React from 'react' +import { Button } from 'shared/ui/button' +import { Separator } from 'shared/ui/separator' export const FormattingToolbar: React.FC = () => (
diff --git a/src/component/TemplateManager/HeaderBar.tsx b/src/component/TemplateManager/HeaderBar.tsx index 18dbd01..b6b5b59 100644 --- a/src/component/TemplateManager/HeaderBar.tsx +++ b/src/component/TemplateManager/HeaderBar.tsx @@ -1,8 +1,8 @@ -import { Button } from '@/component/ui/button' import { Template } from '@/type/template' import { ArrowLeft, FileText, Settings, Wrench } from 'lucide-react' import React from 'react' import { useNavigate } from 'react-router-dom' +import { Button } from 'shared/ui/button' interface HeaderBarProps { template: Template diff --git a/src/component/TemplateManager/TemplateFilterSidebar.tsx b/src/component/TemplateManager/TemplateFilterSidebar.tsx index a4e14d9..abafbb5 100644 --- a/src/component/TemplateManager/TemplateFilterSidebar.tsx +++ b/src/component/TemplateManager/TemplateFilterSidebar.tsx @@ -1,5 +1,10 @@ import { AutocompleteInput } from '@/component/TemplateManager/AutocompleteInput' -import { Button } from '@/component/ui/button' +import { useCategoryContext } from '@/entity/template/model/CategoryContext' +import { Template } from '@/type/template' +import { Filter, X } from 'lucide-react' +import React, { useMemo } from 'react' +import { Button } from 'shared/ui/button' +import { Label } from 'shared/ui/label' import { Sidebar, SidebarContent, @@ -8,12 +13,7 @@ import { SidebarGroupLabel, SidebarHeader, SidebarSeparator, -} from '@/component/ui/sidebar' -import { useCategoryContext } from '@/entity/template/model/CategoryContext' -import { Template } from '@/type/template' -import { Filter, X } from 'lucide-react' -import React, { useMemo } from 'react' -import { Label } from '../ui/label' +} from 'shared/ui/sidebar' export interface TemplateFilters { name: string diff --git a/src/component/TemplateManager/TemplateManager.tsx b/src/component/TemplateManager/TemplateManager.tsx index b05d98f..b5f1172 100644 --- a/src/component/TemplateManager/TemplateManager.tsx +++ b/src/component/TemplateManager/TemplateManager.tsx @@ -1,10 +1,10 @@ import { useTemplateContext } from '@/entity/template/model/TemplateContext' import { Template } from '@/type/template' +import TemplateCard from '@/widget/template/ui/TemplateCard' import { Circle, CircleCheck, FileText, Plus, Trash2 } from 'lucide-react' import React, { useEffect, useState } from 'react' import { useNavigate } from 'react-router-dom' -import TemplateCard from '../../widget/template/ui/TemplateCard' -import { Button } from '../ui/button' +import { Button } from 'shared/ui/button' import { Dialog, DialogContent, @@ -12,8 +12,8 @@ import { DialogHeader, DialogTitle, DialogTrigger, -} from '../ui/dialog' -import { Input } from '../ui/input' +} from 'shared/ui/dialog' +import { Input } from 'shared/ui/input' import { TemplateEditor } from './TemplateEditor' interface TemplateManagerProps { diff --git a/src/component/TemplateManager/VisualLayoutEditor.tsx b/src/component/TemplateManager/VisualLayoutEditor.tsx index a3bd1c0..3a91a0b 100644 --- a/src/component/TemplateManager/VisualLayoutEditor.tsx +++ b/src/component/TemplateManager/VisualLayoutEditor.tsx @@ -1,13 +1,13 @@ -import { Edit, Grid, Move, Trash2 } from 'lucide-react' -import React, { useCallback, useEffect, useMemo, useState } from 'react' -import { Rnd } from 'react-rnd' -import { getElementDefinition } from '../../entity/element/model/interface' +import { getElementDefinition } from '@/entity/element/model/interface' import { ElementLayout, FormLayoutSettings, TemplateElement, -} from '../../type/template' -import { Button } from '../ui/button' +} from '@/type/template' +import { Edit, Grid, Move, Trash2 } from 'lucide-react' +import React, { useCallback, useEffect, useMemo, useState } from 'react' +import { Rnd } from 'react-rnd' +import { Button } from 'shared/ui/button' // Минимальные размеры для разных типов элементов. // Если понадобится скорректировать размеры для конкретного элемента, diff --git a/src/entity/element/model/implementations/ButtonGroup.tsx b/src/entity/element/model/implementations/ButtonGroup.tsx index b61f4b6..d56c1a0 100644 --- a/src/entity/element/model/implementations/ButtonGroup.tsx +++ b/src/entity/element/model/implementations/ButtonGroup.tsx @@ -1,9 +1,9 @@ -import { Button } from '@/component/ui/button' -import { Input } from '@/component/ui/input' import { ElementDefinition } from '@/entity/element/model/interface' import { CellsBadge } from '@/entity/element/ui/cellsBadge' import { ElementOption } from '@/type/template' import { Plus, Square, Trash2 } from 'lucide-react' +import { Button } from 'shared/ui/button' +import { Input } from 'shared/ui/input' interface ButtonGroupConfig { placeholder?: string diff --git a/src/entity/element/model/implementations/SelectElement.tsx b/src/entity/element/model/implementations/SelectElement.tsx index f1eb754..a151f5c 100644 --- a/src/entity/element/model/implementations/SelectElement.tsx +++ b/src/entity/element/model/implementations/SelectElement.tsx @@ -1,5 +1,10 @@ -import { Button } from '@/component/ui/button' -import { Input } from '@/component/ui/input' +import { ElementDefinition } from '@/entity/element/model/interface' +import { CellsBadge } from '@/entity/element/ui/cellsBadge' +import { useToast } from '@/lib/hooks/useToast' +import { ElementOption } from '@/type/template' +import { ChevronDown, Plus, Trash2 } from 'lucide-react' +import { Button } from 'shared/ui/button' +import { Input } from 'shared/ui/input' import { Select, SelectContent, @@ -7,12 +12,7 @@ import { SelectItem, SelectTrigger, SelectValue, -} from '@/component/ui/select' -import { ElementDefinition } from '@/entity/element/model/interface' -import { CellsBadge } from '@/entity/element/ui/cellsBadge' -import { useToast } from '@/lib/hooks/useToast' -import { ElementOption } from '@/type/template' -import { ChevronDown, Plus, Trash2 } from 'lucide-react' +} from 'shared/ui/select' interface SelectConfig { placeholder?: string diff --git a/src/entity/element/model/implementations/StandardsElement/StandardsEditor.tsx b/src/entity/element/model/implementations/StandardsElement/StandardsEditor.tsx index e92add7..dcd554d 100644 --- a/src/entity/element/model/implementations/StandardsElement/StandardsEditor.tsx +++ b/src/entity/element/model/implementations/StandardsElement/StandardsEditor.tsx @@ -1,13 +1,13 @@ -import { Button } from '@/component/ui/button' +import { Info, Settings } from 'lucide-react' +import { useState } from 'react' +import { Button } from 'shared/ui/button' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from '@/component/ui/select' -import { Info, Settings } from 'lucide-react' -import { useState } from 'react' +} from 'shared/ui/select' import { StandardsSelector } from './StandardsSelector' import { StandardsConfig } from './definition' diff --git a/src/entity/element/model/implementations/StandardsElement/StandardsPreview.tsx b/src/entity/element/model/implementations/StandardsElement/StandardsPreview.tsx index fb2ca3d..6c08335 100644 --- a/src/entity/element/model/implementations/StandardsElement/StandardsPreview.tsx +++ b/src/entity/element/model/implementations/StandardsElement/StandardsPreview.tsx @@ -1,6 +1,6 @@ -import { Button } from '@/component/ui/button' -import { Label } from '@/component/ui/label' import { FileText, Settings } from 'lucide-react' +import { Button } from 'shared/ui/button' +import { Label } from 'shared/ui/label' import { StandardsConfig } from './definition' interface StandardsPreviewProps { diff --git a/src/entity/element/model/implementations/StandardsElement/StandardsSelector.tsx b/src/entity/element/model/implementations/StandardsElement/StandardsSelector.tsx index fca8a02..bfb7955 100644 --- a/src/entity/element/model/implementations/StandardsElement/StandardsSelector.tsx +++ b/src/entity/element/model/implementations/StandardsElement/StandardsSelector.tsx @@ -1,13 +1,3 @@ -import { Badge } from '@/component/ui/badge' -import { Button } from '@/component/ui/button' -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, -} from '@/component/ui/dialog' -import { Input } from '@/component/ui/input' -import { Separator } from '@/component/ui/separator' import { useToast } from '@/lib/hooks/useToast' import { DndContext, @@ -36,6 +26,16 @@ import { X, } from 'lucide-react' import { useEffect, useMemo, useRef, useState } from 'react' +import { Badge } from 'shared/ui/badge' +import { Button } from 'shared/ui/button' +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from 'shared/ui/dialog' +import { Input } from 'shared/ui/input' +import { Separator } from 'shared/ui/separator' import { useStandards } from './hooks' import { Standard } from './types' diff --git a/src/entity/element/model/implementations/StandardsElement/definition.tsx b/src/entity/element/model/implementations/StandardsElement/definition.tsx index 196901a..b5c523d 100644 --- a/src/entity/element/model/implementations/StandardsElement/definition.tsx +++ b/src/entity/element/model/implementations/StandardsElement/definition.tsx @@ -1,11 +1,11 @@ -import { Badge } from '@/component/ui/badge' -import { Button } from '@/component/ui/button' -import { Label } from '@/component/ui/label' import { ElementDefinition } from '@/entity/element/model/interface' import { CellsBadge } from '@/entity/element/ui/cellsBadge' import { CellTarget } from '@/type/template' import { FileText, Settings, Weight } from 'lucide-react' import { useEffect, useState } from 'react' +import { Badge } from 'shared/ui/badge' +import { Button } from 'shared/ui/button' +import { Label } from 'shared/ui/label' import { useStandards } from './hooks' import { StandardsEditor } from './StandardsEditor' import { StandardsPreview } from './StandardsPreview' diff --git a/src/entity/element/model/implementations/TextElement.tsx b/src/entity/element/model/implementations/TextElement.tsx index 8204fa5..c3a078c 100644 --- a/src/entity/element/model/implementations/TextElement.tsx +++ b/src/entity/element/model/implementations/TextElement.tsx @@ -1,9 +1,9 @@ -import { Checkbox } from '@/component/ui/checkbox' -import { Input } from '@/component/ui/input' import { ElementDefinition } from '@/entity/element/model/interface' import { CellsBadge } from '@/entity/element/ui/cellsBadge' import { Plus, Save, SaveOff, Type } from 'lucide-react' import { useEffect, useState } from 'react' +import { Checkbox } from 'shared/ui/checkbox' +import { Input } from 'shared/ui/input' interface TextConfig { placeholder?: string diff --git a/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsEditor.tsx b/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsEditor.tsx index c134f59..5f4d140 100644 --- a/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsEditor.tsx +++ b/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsEditor.tsx @@ -1,14 +1,14 @@ -import { Badge } from '@/component/ui/badge' -import { Label } from '@/component/ui/label' +import { CellTarget } from '@/type/template' +import { Building2, Calendar } from 'lucide-react' +import { Badge } from 'shared/ui/badge' +import { Label } from 'shared/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from '@/component/ui/select' -import { CellTarget } from '@/type/template' -import { Building2, Calendar } from 'lucide-react' +} from 'shared/ui/select' import { useLaboratories, useLaboratoryConditions } from './hooks' import { ConditionMapping, VerificationConditionsConfig } from './types' diff --git a/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsPreview.tsx b/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsPreview.tsx index 296f90f..b56ac84 100644 --- a/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsPreview.tsx +++ b/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsPreview.tsx @@ -1,5 +1,3 @@ -import { Button } from '@/component/ui/button' -import { Card, CardContent } from '@/component/ui/card' import { AlertCircle, Building2, @@ -9,6 +7,8 @@ import { Settings, Thermometer, } from 'lucide-react' +import { Button } from 'shared/ui/button' +import { Card, CardContent } from 'shared/ui/card' import { VerificationConditionsConfig } from './types' interface VerificationConditionsPreviewProps { diff --git a/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsRender.tsx b/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsRender.tsx index 1ef4f85..268b99a 100644 --- a/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsRender.tsx +++ b/src/entity/element/model/implementations/VerificationConditionsElement/VerificationConditionsRender.tsx @@ -1,14 +1,3 @@ -import { Button } from '@/component/ui/button' -import { Card, CardContent } from '@/component/ui/card' -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogTrigger, -} from '@/component/ui/dialog' -import { Input } from '@/component/ui/input' -import { Label } from '@/component/ui/label' import { CellsBadge } from '@/entity/element/ui/cellsBadge' import { AlertCircle, @@ -21,6 +10,17 @@ import { Thermometer, } from 'lucide-react' import { useEffect, useState } from 'react' +import { Button } from 'shared/ui/button' +import { Card, CardContent } from 'shared/ui/card' +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from 'shared/ui/dialog' +import { Input } from 'shared/ui/input' +import { Label } from 'shared/ui/label' import { useDailyConditions, useLaboratories, diff --git a/src/lib/hooks/useToast.tsx b/src/lib/hooks/useToast.tsx index 9504ec6..f08459d 100644 --- a/src/lib/hooks/useToast.tsx +++ b/src/lib/hooks/useToast.tsx @@ -1,4 +1,3 @@ -import { Toast, ToastContainer, ToastType } from '@/component/ui/toast' import { createContext, FC, @@ -7,6 +6,7 @@ import { useContext, useState, } from 'react' +import { Toast, ToastContainer, ToastType } from 'shared/ui/toast' interface ToastContextType { showToast: ( diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 7508461..bb512c3 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,15 +1,9 @@ -import { type ClassValue, clsx } from 'clsx' -import { twMerge } from 'tailwind-merge' import { CellTarget, ElementLayout, FormLayoutSettings, TemplateElement, -} from '../type/template' - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) -} +} from '@/type/template' // Миграция элементов из старого формата в новый export function migrateTemplateElement(element: any): TemplateElement { diff --git a/src/page/standards-management/Page.tsx b/src/page/standards-management/Page.tsx index a1adc30..ac88fda 100644 --- a/src/page/standards-management/Page.tsx +++ b/src/page/standards-management/Page.tsx @@ -1,13 +1,3 @@ -import { Badge } from '@/component/ui/badge' -import { Button } from '@/component/ui/button' -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, -} from '@/component/ui/dialog' -import { Input } from '@/component/ui/input' -import { Label } from '@/component/ui/label' import { useCreateStandard, useDeleteStandard, @@ -30,6 +20,16 @@ import { Weight, } from 'lucide-react' import { useEffect, useState } from 'react' +import { Badge } from 'shared/ui/badge' +import { Button } from 'shared/ui/button' +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from 'shared/ui/dialog' +import { Input } from 'shared/ui/input' +import { Label } from 'shared/ui/label' export const StandardsManagementPage = () => { const [searchTerm, setSearchTerm] = useState('') diff --git a/src/page/templates/Page.tsx b/src/page/templates/Page.tsx index b63194c..a78ff7b 100644 --- a/src/page/templates/Page.tsx +++ b/src/page/templates/Page.tsx @@ -3,24 +3,6 @@ import { TemplateFilterSidebar, TemplateFilters, } from '@/component/TemplateManager/TemplateFilterSidebar' -import { Button } from '@/component/ui/button' -import { Card, CardContent, CardHeader, CardTitle } from '@/component/ui/card' -import { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, - DialogTrigger, -} from '@/component/ui/dialog' -import { Input } from '@/component/ui/input' -import { Separator } from '@/component/ui/separator' -import { - SidebarInset, - SidebarProvider, - SidebarTrigger, -} from '@/component/ui/sidebar' import { apiTemplateWithAttributesToTemplate, getTemplateWithAttributesApi, @@ -41,6 +23,24 @@ import { Type, } from 'lucide-react' import { useCallback, useMemo, useState } from 'react' +import { Button } from 'shared/ui/button' +import { Card, CardContent, CardHeader, CardTitle } from 'shared/ui/card' +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from 'shared/ui/dialog' +import { Input } from 'shared/ui/input' +import { Separator } from 'shared/ui/separator' +import { + SidebarInset, + SidebarProvider, + SidebarTrigger, +} from 'shared/ui/sidebar' interface AttributeValue { attributeId: string diff --git a/src/page/templates/elements/Page.tsx b/src/page/templates/elements/Page.tsx index 8f5db79..19c8060 100644 --- a/src/page/templates/elements/Page.tsx +++ b/src/page/templates/elements/Page.tsx @@ -1,11 +1,11 @@ import { ElementConstructor } from '@/component/TemplateManager/ElementConstructor' -import { Button } from '@/component/ui/button' import { useTemplateContext } from '@/entity/template/model/TemplateContext' import { useDelayedSave } from '@/hook/useDelayedSave' import { FormLayoutSettings, Template, TemplateElement } from '@/type/template' import { ArrowLeft, FileText, Settings, Wrench } from 'lucide-react' import { FC, useCallback, useEffect, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' +import { Button } from 'shared/ui/button' export const ElementsCreation: FC = () => { const navigate = useNavigate() diff --git a/src/page/templates/protocols/Page.tsx b/src/page/templates/protocols/Page.tsx index bb85545..df60971 100644 --- a/src/page/templates/protocols/Page.tsx +++ b/src/page/templates/protocols/Page.tsx @@ -1,5 +1,4 @@ import DualSpreadsheet from '@/component/DualSpreadsheet/DualSpreadsheet' -import { Button } from '@/component/ui/button' import { getElementDefinition } from '@/entity/element/model/interface' import { useTemplateContext } from '@/entity/template/model/TemplateContext' import { cellAddressToCoordinates } from '@/lib/cell-utils' @@ -9,6 +8,7 @@ import { Template, TemplateElement } from '@/type/template' import { ArrowLeft, FileText, Grid, Save, Settings, Wrench } from 'lucide-react' import { FC, useEffect, useMemo, useRef, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' +import { Button } from 'shared/ui/button' interface ProtocolFormProps { template: Template diff --git a/src/widget/template/ui/TemplateCard.tsx b/src/widget/template/ui/TemplateCard.tsx index 28040c3..552b4fd 100644 --- a/src/widget/template/ui/TemplateCard.tsx +++ b/src/widget/template/ui/TemplateCard.tsx @@ -1,11 +1,11 @@ -import { Button } from '@/component/ui/button' -import { Card, CardContent, CardHeader, CardTitle } from '@/component/ui/card' -import { Popover, PopoverContent, PopoverTrigger } from '@/component/ui/popover' import { Template, TemplateAttributeDetail } from '@/type/template' import clsx from 'clsx' import { Check, Copy, MoreVertical, Pencil, Trash2 } from 'lucide-react' import React from 'react' import { useNavigate } from 'react-router-dom' +import { Button } from 'shared/ui/button' +import { Card, CardContent, CardHeader, CardTitle } from 'shared/ui/card' +import { Popover, PopoverContent, PopoverTrigger } from 'shared/ui/popover' interface TemplateCardProps { template: Template & { attributes?: TemplateAttributeDetail[] } diff --git a/tsconfig.json b/tsconfig.json index 955ce8b..b40f757 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,8 @@ "outDir": "./dist/", "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "shared/*": ["./shared/*"] }, "skipLibCheck": true }, diff --git a/vite.config.ts b/vite.config.ts index 452375d..56e3a06 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,22 +2,18 @@ import react from '@vitejs/plugin-react-swc' import path from 'path' import { defineConfig } from 'vite' -// https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], resolve: { alias: { '@': path.resolve(__dirname, 'src'), - '@widgets': path.resolve('src/widgets'), - '@features': path.resolve('src/features'), - '@entities': path.resolve('src/entities'), + shared: path.resolve(__dirname, 'shared'), }, }, server: { - host: '0.0.0.0', // Открыть для всех IP адресов + host: '0.0.0.0', proxy: { '/api': { - //192.168.2.66 target: 'http://localhost:8000', changeOrigin: true, rewrite: path => path.replace(/^\/api/, ''),