mirror of
https://github.com/docmost/docmost.git
synced 2026-05-20 00:14:10 +08:00
rename current device property
This commit is contained in:
@@ -26,7 +26,7 @@ export default function SessionList() {
|
|||||||
const revokeAllSessionsMutation = useRevokeAllSessionsMutation();
|
const revokeAllSessionsMutation = useRevokeAllSessionsMutation();
|
||||||
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
|
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
|
||||||
|
|
||||||
const otherSessions = sessions?.filter((s) => !s.isCurrent) ?? [];
|
const otherSessions = sessions?.filter((s) => !s?.isCurrentDevice) ?? [];
|
||||||
const visibleSessions = sessions?.slice(0, visibleCount) ?? [];
|
const visibleSessions = sessions?.slice(0, visibleCount) ?? [];
|
||||||
const hasMore = sessions && visibleCount < sessions.length;
|
const hasMore = sessions && visibleCount < sessions.length;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ export default function SessionList() {
|
|||||||
<Text size="sm">
|
<Text size="sm">
|
||||||
{session.deviceName || t("Unknown device")}
|
{session.deviceName || t("Unknown device")}
|
||||||
</Text>
|
</Text>
|
||||||
{session.isCurrent && (
|
{session?.isCurrentDevice && (
|
||||||
<Text size="xs" c="blue">
|
<Text size="xs" c="blue">
|
||||||
{t("This Device")}
|
{t("This Device")}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -117,14 +117,14 @@ export default function SessionList() {
|
|||||||
</Table.Td>
|
</Table.Td>
|
||||||
<Table.Td>
|
<Table.Td>
|
||||||
<Text size="sm">
|
<Text size="sm">
|
||||||
{session.isCurrent
|
{session?.isCurrentDevice
|
||||||
? t("Now")
|
? t("Now")
|
||||||
: formattedDate(new Date(session.lastActiveAt))}
|
: formattedDate(new Date(session.lastActiveAt))}
|
||||||
</Text>
|
</Text>
|
||||||
</Table.Td>
|
</Table.Td>
|
||||||
{otherSessions.length > 0 && (
|
{otherSessions.length > 0 && (
|
||||||
<Table.Td>
|
<Table.Td>
|
||||||
{!session.isCurrent && (
|
{!session?.isCurrentDevice && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ export type ISession = {
|
|||||||
geoLocation: string | null;
|
geoLocation: string | null;
|
||||||
lastActiveAt: string;
|
lastActiveAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
isCurrent: boolean;
|
isCurrentDevice?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -71,12 +71,12 @@ export class SessionService {
|
|||||||
geoLocation: s.geoLocation,
|
geoLocation: s.geoLocation,
|
||||||
lastActiveAt: s.lastActiveAt,
|
lastActiveAt: s.lastActiveAt,
|
||||||
createdAt: s.createdAt,
|
createdAt: s.createdAt,
|
||||||
isCurrent: s.id === currentSessionId,
|
isCurrentDevice: s.id === currentSessionId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return mapped.sort((a, b) => {
|
return mapped.sort((a, b) => {
|
||||||
if (a.isCurrent) return -1;
|
if (a.isCurrentDevice) return -1;
|
||||||
if (b.isCurrent) return 1;
|
if (b.isCurrentDevice) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user