gitscope
← marzneshin / Diff · 5a19530 → 5a19530
Changes 5a19530..5a19530
Patch commit
diff --git a/dashboard/biome.json b/dashboard/biome.json
index 0506472..55e716c 100644
--- a/dashboard/biome.json
+++ b/dashboard/biome.json
@@ -2,7 +2,7 @@
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
"formatter": {
"indentStyle": "space",
- "indentSize": 2
+ "indentSize": 4
},
"json": {
"formatter": {
diff --git a/dashboard/public/locales/en.json b/dashboard/public/locales/en.json
index 40cf1f5..d347a2d 100644
--- a/dashboard/public/locales/en.json
+++ b/dashboard/public/locales/en.json
@@ -165,6 +165,8 @@
}
},
"users": {
+ "created_at": "Created At",
+ "no_use": "No Use",
"data_limit_reached": "Data Limit Reached",
"note-placeholder": "Additional information about user",
"data_limit": "Data Limit",
diff --git a/dashboard/src/components/info-table/date-table-row.tsx b/dashboard/src/components/info-table/date-table-row.tsx
index 29c10a9..30ee182 100644
--- a/dashboard/src/components/info-table/date-table-row.tsx
+++ b/dashboard/src/components/info-table/date-table-row.tsx
@@ -1,14 +1,15 @@
-import { FC } from "react";
+import type { FC } from "react";
import { TableRowWithCell } from "./table-row-with-cell";
import { format, isValid } from "date-fns";
-export const DateTableRow: FC<{ label: string; date?: Date | null | string }> = ({
- label,
- date,
-}) => {
+export const DateTableRow: FC<{
+ label: string;
+ withTime?: boolean;
+ date?: Date | null | string;
+}> = ({ label, date, withTime = false }) => {
let formattedDate = "";
if (date && isValid(new Date(date))) {
- formattedDate = format(date, "PPP");
+ formattedDate = format(new Date(date + "Z"), withTime ? "Ppp" : "P");
}
return <TableRowWithCell label={label} value={formattedDate} />;
};
diff --git a/dashboard/src/components/settings-dialog/index.tsx b/dashboard/src/components/settings-dialog/index.tsx
index a864338..3ba5582 100644
--- a/dashboard/src/components/settings-dialog/index.tsx
+++ b/dashboard/src/components/settings-dialog/index.tsx
@@ -32,7 +32,7 @@ export const SettingsDialog: FC<SettingsDialogProps & PropsWithChildren> = ({
<SheetHeader>
<SheetTitle>{t("settings")}</SheetTitle>
</SheetHeader>
- <ScrollArea className="flex flex-col gap-4 h-full">
+ <ScrollArea className="flex flex-col gap-4 h-full max-h-[40rem]">
{children}
</ScrollArea>
</SheetContent>
diff --git a/dashboard/src/features/users/components/dialogs/settings/user-info/table.tsx b/dashboard/src/features/users/components/dialogs/settings/user-info/table.tsx
index 86806c7..fbbc841 100644
--- a/dashboard/src/features/users/components/dialogs/settings/user-info/table.tsx
+++ b/dashboard/src/features/users/components/dialogs/settings/user-info/table.tsx
@@ -7,8 +7,9 @@ import {
TableBody,
TableRowWithCell,
DateTableRow,
+ Badge
} from "@marzneshin/components";
-import { FC } from "react";
+import type { FC } from "react";
import {
type UserProp,
UserEnabledPill,
@@ -21,9 +22,7 @@ import { useTranslation } from "react-i18next";
export const UserInfoTable: FC<UserProp> = ({ user: entity }) => {
const { t } = useTranslation();
- const expireDate = entity.expire_date
- ? new Date(entity.expire_date)
- : null;
+ const expireDate = entity.expire_date ? new Date(entity.expire_date) : null;
return (
<Card>
@@ -50,40 +49,57 @@ export const UserInfoTable: FC<UserProp> = ({ user: entity }) => {
label={t("expired")}
value={<UserExpiredPill user={entity} />}
/>
- {{
- fixed_date: (
- <DateTableRow
- label={t("page.users.expire_date")}
- date={expireDate}
- />
- ),
- start_on_first_use: (
- <>
- <TableRowWithCell
- label={t("page.users.usage_duration")}
- value={(entity.usage_duration ? entity.usage_duration : 0) / 86400}
- />
+ {
+ {
+ fixed_date: (
<DateTableRow
- label={t("page.users.activation_deadline")}
- date={entity.activation_deadline}
+ label={t("page.users.expire_date")}
+ date={expireDate}
+ />
+ ),
+ start_on_first_use: (
+ <>
+ <TableRowWithCell
+ label={t("page.users.usage_duration")}
+ value={
+ (entity.usage_duration ? entity.usage_duration : 0) /
+ 86400
+ }
+ />
+ <DateTableRow
+ label={t("page.users.activation_deadline")}
+ date={entity.activation_deadline}
+ />
+ </>
+ ),
+ never: (
+ <TableRowWithCell
+ label={t("page.users.expire_method")}
+ value={t("never")}
/>
- </>
- ),
- never: (
- <TableRowWithCell
- label={t("page.users.expire_method")}
- value={t('never')}
- />
- )
- }[entity.expire_strategy]}
+ ),
+ }[entity.expire_strategy]
+ }
<TableRowWithCell
label={t("page.users.used_traffic")}
value={<UserUsedTraffic user={entity} />}
/>
+ {entity.online_at ? (
+ <DateTableRow
+ label={t("page.users.online_at")}
+ date={entity.online_at}
+ withTime
+ />
+ ) : (
+ <TableRowWithCell
+ label={t("page.users.online_at")}
+ value={<Badge>{t("page.users.no_use")}</Badge>}
+ />
+ )}
<DateTableRow
- label={t("page.users.online_at")}
- date={entity.online_at}
+ label={t("page.users.created_at")}
+ date={entity.created_at}
/>
<TableRowWithCell label={t("note")} value={entity.note} />
</TableBody>
diff --git a/dashboard/src/features/users/components/tables/users/columns.tsx b/dashboard/src/features/users/components/tables/users/columns.tsx
index 4c387f9..711f61d 100644
--- a/dashboard/src/features/users/components/tables/users/columns.tsx
+++ b/dashboard/src/features/users/components/tables/users/columns.tsx
@@ -29,7 +29,7 @@ export const columns = (actions: ColumnActions<UserType>): ColumnDefWithSudoRole
<OnlineStatus user={row.original} /> {row.original.username}
</div>
),
- },
+ },
{
accessorKey: "activated",
enableSorting: false,