diff --git a/CHANGELOG.md b/CHANGELOG.md index 43fbf8d..b1f2620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,39 +1,37 @@ + # Changelog # [1.3.0](https://github.com/perfect-panel/ppanel-web/compare/v1.2.0...v1.3.0) (2025-08-15) - ### ♻ Code Refactoring -* Refactoring and adding multiple features ([65c9b9f](https://github.com/perfect-panel/ppanel-web/commit/65c9b9f)) - +- Refactoring and adding multiple features ([65c9b9f](https://github.com/perfect-panel/ppanel-web/commit/65c9b9f)) ### ✨ Features -* **api**: Add getClient API endpoint to retrieve subscription applications ([7a279e6](https://github.com/perfect-panel/ppanel-web/commit/7a279e6)) -* **marketing**: Add marketing management features and localization updates ([ea08de0](https://github.com/perfect-panel/ppanel-web/commit/ea08de0)) -* **protocol**: Add template preview functionality with localization support ([0448d21](https://github.com/perfect-panel/ppanel-web/commit/0448d21)) -* **subscribe**: Update subscription management localization and add new fields ([1d9b0a4](https://github.com/perfect-panel/ppanel-web/commit/1d9b0a4)) - +- **api**: Add getClient API endpoint to retrieve subscription applications ([7a279e6](https://github.com/perfect-panel/ppanel-web/commit/7a279e6)) +- **marketing**: Add marketing management features and localization updates ([ea08de0](https://github.com/perfect-panel/ppanel-web/commit/ea08de0)) +- **protocol**: Add template preview functionality with localization support ([0448d21](https://github.com/perfect-panel/ppanel-web/commit/0448d21)) +- **subscribe**: Update subscription management localization and add new fields ([1d9b0a4](https://github.com/perfect-panel/ppanel-web/commit/1d9b0a4)) ### 🐛 Bug Fixes -* **bun**: Update bun.lockb to reflect dependency changes ([bbcd018](https://github.com/perfect-panel/ppanel-web/commit/bbcd018)) -* **editor**: Add Go template editor component and update related schemas ([9d9c3cd](https://github.com/perfect-panel/ppanel-web/commit/9d9c3cd)) -* **editor**: Enhance Go Template Editor to support trimmed template tags and improve range/end matching ([641ed5e](https://github.com/perfect-panel/ppanel-web/commit/641ed5e)) -* **editor**: Enhance Go Template Editor with schema support and improved completion ([5b21d8a](https://github.com/perfect-panel/ppanel-web/commit/5b21d8a)) -* **enhaced-input**: Disable autocomplete for EnhancedInput component ([f190c68](https://github.com/perfect-panel/ppanel-web/commit/f190c68)) -* **global**: Add user agent limit settings to subscription configuration ([822416d](https://github.com/perfect-panel/ppanel-web/commit/822416d)) -* **locales**: Update 'conf' output format to use uppercase 'CONF' ([fce9119](https://github.com/perfect-panel/ppanel-web/commit/fce9119)) -* **locales**: Update "userAccount" label to "user" in multiple localization files ([48415e9](https://github.com/perfect-panel/ppanel-web/commit/48415e9)) -* **protocol-form**: Swap 'description' and 'user_agent' columns for improved clarity in the table ([72a4106](https://github.com/perfect-panel/ppanel-web/commit/72a4106)) -* **protocol-form**: Update protocol options descriptions for clarity and add new security and transport options ([e5d4deb](https://github.com/perfect-panel/ppanel-web/commit/e5d4deb)) -* **protocol**: Add 'conf' output format option and update translations ([292efdf](https://github.com/perfect-panel/ppanel-web/commit/292efdf)) -* **protpcp-form**: Rename 'schema' to 'scheme' for consistency across the application ([6ab2ba9](https://github.com/perfect-panel/ppanel-web/commit/6ab2ba9)) -* **register**: Update localization files to include trial subscription settings and descriptions ([33daa1f](https://github.com/perfect-panel/ppanel-web/commit/33daa1f)) -* **system**: Add time unit translations for user registration settings in multiple languages ([296a6c1](https://github.com/perfect-panel/ppanel-web/commit/296a6c1)) -* Update privacy policy and terms of service schemas to use correct field names ([0e6ba5b](https://github.com/perfect-panel/ppanel-web/commit/0e6ba5b)) +- **bun**: Update bun.lockb to reflect dependency changes ([bbcd018](https://github.com/perfect-panel/ppanel-web/commit/bbcd018)) +- **editor**: Add Go template editor component and update related schemas ([9d9c3cd](https://github.com/perfect-panel/ppanel-web/commit/9d9c3cd)) +- **editor**: Enhance Go Template Editor to support trimmed template tags and improve range/end matching ([641ed5e](https://github.com/perfect-panel/ppanel-web/commit/641ed5e)) +- **editor**: Enhance Go Template Editor with schema support and improved completion ([5b21d8a](https://github.com/perfect-panel/ppanel-web/commit/5b21d8a)) +- **enhaced-input**: Disable autocomplete for EnhancedInput component ([f190c68](https://github.com/perfect-panel/ppanel-web/commit/f190c68)) +- **global**: Add user agent limit settings to subscription configuration ([822416d](https://github.com/perfect-panel/ppanel-web/commit/822416d)) +- **locales**: Update 'conf' output format to use uppercase 'CONF' ([fce9119](https://github.com/perfect-panel/ppanel-web/commit/fce9119)) +- **locales**: Update "userAccount" label to "user" in multiple localization files ([48415e9](https://github.com/perfect-panel/ppanel-web/commit/48415e9)) +- **protocol-form**: Swap 'description' and 'user_agent' columns for improved clarity in the table ([72a4106](https://github.com/perfect-panel/ppanel-web/commit/72a4106)) +- **protocol-form**: Update protocol options descriptions for clarity and add new security and transport options ([e5d4deb](https://github.com/perfect-panel/ppanel-web/commit/e5d4deb)) +- **protocol**: Add 'conf' output format option and update translations ([292efdf](https://github.com/perfect-panel/ppanel-web/commit/292efdf)) +- **protpcp-form**: Rename 'schema' to 'scheme' for consistency across the application ([6ab2ba9](https://github.com/perfect-panel/ppanel-web/commit/6ab2ba9)) +- **register**: Update localization files to include trial subscription settings and descriptions ([33daa1f](https://github.com/perfect-panel/ppanel-web/commit/33daa1f)) +- **system**: Add time unit translations for user registration settings in multiple languages ([296a6c1](https://github.com/perfect-panel/ppanel-web/commit/296a6c1)) +- Update privacy policy and terms of service schemas to use correct field names ([0e6ba5b](https://github.com/perfect-panel/ppanel-web/commit/0e6ba5b)) diff --git a/apps/admin/app/dashboard/application/config.tsx b/apps/admin/app/dashboard/application/config.tsx deleted file mode 100644 index 14082a0..0000000 --- a/apps/admin/app/dashboard/application/config.tsx +++ /dev/null @@ -1,282 +0,0 @@ -'use client'; - -import { - getApplication, - getApplicationConfig, - updateApplicationConfig, -} from '@/services/admin/system'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { Icon } from '@iconify/react'; -import { useQuery } from '@tanstack/react-query'; -import { Button } from '@workspace/ui/components/button'; -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@workspace/ui/components/form'; -import { ScrollArea } from '@workspace/ui/components/scroll-area'; -import { - Sheet, - SheetContent, - SheetFooter, - SheetHeader, - SheetTitle, - SheetTrigger, -} from '@workspace/ui/components/sheet'; -import { Textarea } from '@workspace/ui/components/textarea'; -import { Combobox } from '@workspace/ui/custom-components/combobox'; -import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; -import { UploadImage } from '@workspace/ui/custom-components/upload-image'; -import { DicesIcon } from 'lucide-react'; -import { useTranslations } from 'next-intl'; -import { uid } from 'radash'; -import { useEffect, useState } from 'react'; -import { useForm } from 'react-hook-form'; -import { toast } from 'sonner'; -import { z } from 'zod'; - -const formSchema = z.object({ - app_id: z.number().optional(), - encryption_key: z.string().optional(), - encryption_method: z.string().optional(), - startup_picture: z.string().optional(), - startup_picture_skip_time: z.number().optional(), - domains: z.array(z.string()).optional(), -}); - -type FormSchema = z.infer; - -export default function ConfigForm() { - const t = useTranslations('product.app'); - const [open, setOpen] = useState(false); - const [loading, setLoading] = useState(false); - - const form = useForm({ - resolver: zodResolver(formSchema), - defaultValues: { - app_id: 0, - encryption_key: '', - encryption_method: '', - startup_picture: '', - startup_picture_skip_time: 0, - domains: [], - }, - }); - - const { data, refetch } = useQuery({ - queryKey: ['getApplicationConfig'], - queryFn: async () => { - const { data } = await getApplicationConfig(); - return data.data; - }, - }); - - const { data: applications } = useQuery({ - queryKey: ['getApplication'], - queryFn: async () => { - const { data } = await getApplication(); - return data.data?.applications || []; - }, - }); - - useEffect(() => { - if (data) { - form.reset(data); - } - }, [data, form]); - - async function onSubmit(values: FormSchema) { - setLoading(true); - try { - await updateApplicationConfig({ - ...values, - domains: values.domains?.filter((domain) => domain), - } as API.ApplicationConfig); - toast.success(t('updateSuccess')); - refetch(); - setOpen(false); - } catch (error) { - /* empty */ - } finally { - setLoading(false); - } - } - - return ( - - - - - - - {t('configApp')} - - -
- - ( - - {t('selectApp')} - {t('selectAppDescription')} - - ({ - label: app.name, - value: app.id, - })) || [] - } - value={field.value} - onChange={(value) => form.setValue(field.name, value)} - /> - - - - )} - /> - ( - - {t('communicationKey')} - {t('communicationKeyDescription')} - - form.setValue(field.name, value as string)} - suffix={ -
- { - const id = uid(32).toLowerCase(); - const formatted = `${id.slice(0, 8)}-${id.slice(8, 12)}-${id.slice(12, 16)}-${id.slice(16, 20)}-${id.slice(20)}`; - form.setValue(field.name, formatted); - }} - className='cursor-pointer' - /> -
- } - /> -
- -
- )} - /> - ( - - {t('encryption')} - {t('encryptionDescription')} - - form.setValue(field.name, value)} - /> - - - - )} - /> - ( - - {t('startupPicture')} - {t('startupPictureDescription')} - - form.setValue(field.name, value as string)} - suffix={ - form.setValue('startup_picture', value as string)} - /> - } - /> - - - - )} - /> - - ( - - {t('startupPictureSkip')} - {t('startupPictureSkipDescription')} - - - form.setValue('startup_picture_skip_time', Number(value)) - } - /> - - - - )} - /> - - ( - - {t('backupDomains')} - {t('backupDomainsDescription')} - -