fix: active sessions icons and delete button

This commit is contained in:
Sajad Mirjalili
2025-09-29 17:57:54 +03:30
parent 8808d9bdb1
commit 6f96198c53
2 changed files with 12 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ import {
Stack, Stack,
} from '@mui/material'; } from '@mui/material';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { DeviceMessage, Logout } from 'iconsax-react'; import { DeviceMessage, Logout, Mobile } from 'iconsax-react';
import { CardContainer } from '@/components/CardContainer'; import { CardContainer } from '@/components/CardContainer';
import { PageWrapper } from '../components/PageWrapper'; import { PageWrapper } from '../components/PageWrapper';
import { Icon } from '@rkheftan/harmony-ui'; import { Icon } from '@rkheftan/harmony-ui';
@@ -43,7 +43,8 @@ export function ActiveDevicesPage() {
const formattedDevices = sessions.map((session: ApiSession) => ({ const formattedDevices = sessions.map((session: ApiSession) => ({
id: session.key, id: session.key,
timeAndDate: formatDate(session.created, i18n.language, t), timeAndDate: formatDate(session.created, i18n.language, t),
deviceModel: `${session.deviceOs} ${session.deviceName}`, deviceOs: session.deviceOs,
deviceName: session.deviceName,
ip: session.ipAddress, ip: session.ipAddress,
current: session.key === currentKey, current: session.key === currentKey,
})); }));
@@ -199,12 +200,16 @@ export function ActiveDevicesPage() {
}} }}
> >
<Icon <Icon
Component={DeviceMessage} Component={
device.deviceName === 'smartphone'
? Mobile
: DeviceMessage
}
size="medium" size="medium"
color="primary.main" color="primary.main"
/> />
<Typography variant="body2" noWrap> <Typography variant="body2" noWrap>
{device.deviceModel} {`${device.deviceOs} ${device.deviceName}`}
</Typography> </Typography>
</Box> </Box>
@@ -253,6 +258,7 @@ export function ActiveDevicesPage() {
} }
loading={loadingDeleteIds.includes(device.id)} loading={loadingDeleteIds.includes(device.id)}
onClick={() => handleDeleteDevice(device.id)} onClick={() => handleDeleteDevice(device.id)}
fullWidth={false}
sx={{ sx={{
color: 'error.main', color: 'error.main',
borderRadius: 1, borderRadius: 1,

View File

@@ -19,7 +19,8 @@ export interface InfoRowData {
export interface Device { export interface Device {
id: string; id: string;
timeAndDate: string; timeAndDate: string;
deviceModel: string; deviceName: 'smartphone' | 'desktop' | string;
deviceOs: string;
ip: string; ip: string;
current: boolean; current: boolean;
} }