From f432ba06f9d3a86ec00bfd316d1c020ddf779de6 Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Mon, 29 Dec 2025 06:12:10 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Refactor=20SubscriptionForm?= =?UTF-8?q?=20layout=20for=20improved=20readability=20and=20maintainabilit?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user-subscription/subscription-form.tsx | 280 +++++++++--------- 1 file changed, 142 insertions(+), 138 deletions(-) diff --git a/apps/admin/src/sections/user/user-subscription/subscription-form.tsx b/apps/admin/src/sections/user/user-subscription/subscription-form.tsx index 3001fea..9eb1051 100644 --- a/apps/admin/src/sections/user/user-subscription/subscription-form.tsx +++ b/apps/admin/src/sections/user/user-subscription/subscription-form.tsx @@ -96,144 +96,148 @@ export function SubscriptionForm({ {title} -
- - ( - - {t("subscription", "Subscription")} - - - onChange={(value) => { - form.setValue(field.name, value); - }} - options={subscribes?.map((item) => ({ - value: item.id!, - label: item.name!, - }))} - placeholder="Select Subscription" - value={field.value} - /> - - - - )} - /> - ( - - {t("trafficLimit", "Traffic Limit")} - - - unitConversion("bytesToGb", value) - } - formatOutput={(value) => - unitConversion("gbToBytes", value) - } - onValueChange={(value) => { - form.setValue(field.name, value as number); - }} - suffix="GB" - /> - - - - )} - /> - ( - - - {t("uploadTraffic", "Upload Traffic")} - - - - unitConversion("bytesToGb", value) - } - formatOutput={(value) => - unitConversion("gbToBytes", value) - } - onValueChange={(value) => { - form.setValue(field.name, value as number); - }} - suffix="GB" - /> - - - - )} - /> - ( - - - {t("downloadTraffic", "Download Traffic")} - - - - unitConversion("bytesToGb", value) - } - formatOutput={(value) => - unitConversion("gbToBytes", value) - } - onValueChange={(value) => { - form.setValue(field.name, value as number); - }} - suffix="GB" - /> - - - - )} - /> - ( - - {t("expiredAt", "Expired At")} - - { - form.setValue(field.name, value || 0); - }} - placeholder={t("permanent", "Permanent")} - value={ - field.value && field.value > 0 - ? field.value - : undefined - } - /> - - - - )} - /> - - +
+
+ + ( + + {t("subscription", "Subscription")} + + + onChange={(value) => { + form.setValue(field.name, value); + }} + options={subscribes?.map((item) => ({ + value: item.id!, + label: item.name!, + }))} + placeholder="Select Subscription" + value={field.value} + /> + + + + )} + /> + ( + + + {t("trafficLimit", "Traffic Limit")} + + + + unitConversion("bytesToGb", value) + } + formatOutput={(value) => + unitConversion("gbToBytes", value) + } + onValueChange={(value) => { + form.setValue(field.name, value as number); + }} + suffix="GB" + /> + + + + )} + /> + ( + + + {t("uploadTraffic", "Upload Traffic")} + + + + unitConversion("bytesToGb", value) + } + formatOutput={(value) => + unitConversion("gbToBytes", value) + } + onValueChange={(value) => { + form.setValue(field.name, value as number); + }} + suffix="GB" + /> + + + + )} + /> + ( + + + {t("downloadTraffic", "Download Traffic")} + + + + unitConversion("bytesToGb", value) + } + formatOutput={(value) => + unitConversion("gbToBytes", value) + } + onValueChange={(value) => { + form.setValue(field.name, value as number); + }} + suffix="GB" + /> + + + + )} + /> + ( + + {t("expiredAt", "Expired At")} + + { + form.setValue(field.name, value || 0); + }} + placeholder={t("permanent", "Permanent")} + value={ + field.value && field.value > 0 + ? field.value + : undefined + } + /> + + + + )} + /> + + +