mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
feat: add gift subscription toggle to admin branding settings
Add CABINET_GIFT_ENABLED toggle in Admin Settings > Branding > Interface Options, alongside existing fullscreen and email auth toggles. Includes updateGiftEnabled API method and i18n keys for all 4 locales (ru/en/zh/fa).
This commit is contained in:
@@ -35,6 +35,11 @@ export function BrandingTab({ accentColor = '#3b82f6' }: BrandingTabProps) {
|
||||
queryFn: brandingApi.getEmailAuthEnabled,
|
||||
});
|
||||
|
||||
const { data: giftSettings } = useQuery({
|
||||
queryKey: ['gift-enabled'],
|
||||
queryFn: brandingApi.getGiftEnabled,
|
||||
});
|
||||
|
||||
// Mutations
|
||||
const updateBrandingMutation = useMutation({
|
||||
mutationFn: brandingApi.updateName,
|
||||
@@ -76,6 +81,13 @@ export function BrandingTab({ accentColor = '#3b82f6' }: BrandingTabProps) {
|
||||
},
|
||||
});
|
||||
|
||||
const updateGiftMutation = useMutation({
|
||||
mutationFn: (enabled: boolean) => brandingApi.updateGiftEnabled(enabled),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['gift-enabled'] });
|
||||
},
|
||||
});
|
||||
|
||||
const handleLogoUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (file) {
|
||||
@@ -225,6 +237,18 @@ export function BrandingTab({ accentColor = '#3b82f6' }: BrandingTabProps) {
|
||||
disabled={updateEmailAuthMutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-xl bg-dark-700/30 p-4">
|
||||
<div>
|
||||
<span className="font-medium text-dark-100">{t('admin.settings.giftEnabled')}</span>
|
||||
<p className="text-sm text-dark-400">{t('admin.settings.giftEnabledDesc')}</p>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={giftSettings?.enabled ?? false}
|
||||
onChange={() => updateGiftMutation.mutate(!(giftSettings?.enabled ?? false))}
|
||||
disabled={updateGiftMutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user