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 ; }; 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 = ({ {t("settings")} - + {children} 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 = ({ 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 ( @@ -50,40 +49,57 @@ export const UserInfoTable: FC = ({ user: entity }) => { label={t("expired")} value={} /> - {{ - fixed_date: ( - - ), - start_on_first_use: ( - <> - + { + { + fixed_date: ( + ), + start_on_first_use: ( + <> + + + + ), + never: ( + - - ), - never: ( - - ) - }[entity.expire_strategy]} + ), + }[entity.expire_strategy] + } } /> + {entity.online_at ? ( + + ) : ( + {t("page.users.no_use")}} + /> + )} 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): ColumnDefWithSudoRole {row.original.username} ), - }, + }, { accessorKey: "activated", enableSorting: false,