fixed layout of profile cards
This commit is contained in:
@@ -65,7 +65,10 @@ import {
|
|||||||
ListFilter,
|
ListFilter,
|
||||||
ListTree,
|
ListTree,
|
||||||
CheckCircle,
|
CheckCircle,
|
||||||
|
Infinity,
|
||||||
|
RefreshCw
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
import {t} from "i18next";
|
||||||
|
|
||||||
// Активируем плагин для dayjs
|
// Активируем плагин для dayjs
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
@@ -89,8 +92,8 @@ const parseExpire = (expire?: number | string): string | null => {
|
|||||||
const expireDate = dayjs(expireTimestamp * 1000);
|
const expireDate = dayjs(expireTimestamp * 1000);
|
||||||
if (!expireDate.isValid()) return null;
|
if (!expireDate.isValid()) return null;
|
||||||
const now = dayjs();
|
const now = dayjs();
|
||||||
if (expireDate.isBefore(now)) return "Expired";
|
if (expireDate.isBefore(now)) return t("Expired");
|
||||||
return `Expires in ${expireDate.fromNow(true)}`;
|
return t('Expires in', { duration: expireDate.fromNow(true) });
|
||||||
};
|
};
|
||||||
|
|
||||||
type MenuItemAction = {
|
type MenuItemAction = {
|
||||||
@@ -307,6 +310,7 @@ export const ProfileItem = (props: Props) => {
|
|||||||
<p className="text-sm font-semibold truncate" title={name}>
|
<p className="text-sm font-semibold truncate" title={name}>
|
||||||
{name}
|
{name}
|
||||||
</p>
|
</p>
|
||||||
|
{expireInfo === t("Expired") ? <Badge variant="destructive" className="text-xs bg-red-500 text-white dark:bg-red-500">{t(expireInfo)}</Badge> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center flex-shrink-0">
|
<div className="flex items-center flex-shrink-0">
|
||||||
<Badge
|
<Badge
|
||||||
@@ -329,6 +333,14 @@ export const ProfileItem = (props: Props) => {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Clock className="h-3 w-3 inline mr-1.5" />
|
<Clock className="h-3 w-3 inline mr-1.5" />
|
||||||
|
<span>
|
||||||
|
{expireInfo === null ? <Infinity className="h-3 w-3 inline mr-1.5"/>: expireInfo}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center">
|
||||||
|
<RefreshCw className="h-3 w-3 inline mr-1.5" />
|
||||||
<span>
|
<span>
|
||||||
{updated > 0
|
{updated > 0
|
||||||
? dayjs(updated * 1000).fromNow()
|
? dayjs(updated * 1000).fromNow()
|
||||||
@@ -338,18 +350,8 @@ export const ProfileItem = (props: Props) => {
|
|||||||
<Loader2 className="h-3 w-3 ml-1.5 animate-spin" />
|
<Loader2 className="h-3 w-3 ml-1.5 animate-spin" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{expireInfo && (
|
|
||||||
<Badge
|
|
||||||
variant={
|
|
||||||
expireInfo === "Expired" ? "destructive" : "outline"
|
|
||||||
}
|
|
||||||
className="text-xs"
|
|
||||||
>
|
|
||||||
<AlertTriangle className="h-3 w-3 inline mr-1.5" />
|
|
||||||
{expireInfo}
|
|
||||||
</Badge>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ const ProfilePage = () => {
|
|||||||
onDragEnd={onDragEnd}
|
onDragEnd={onDragEnd}
|
||||||
>
|
>
|
||||||
<div className="p-4 pt-0">
|
<div className="p-4 pt-0">
|
||||||
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3">
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
||||||
<SortableContext items={profileItems.map((x) => x.uid)}>
|
<SortableContext items={profileItems.map((x) => x.uid)}>
|
||||||
{profileItems.map((item) => (
|
{profileItems.map((item) => (
|
||||||
<ProfileItem
|
<ProfileItem
|
||||||
|
|||||||
Reference in New Issue
Block a user