Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add room creation date in admin panel #32669

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/meteor/client/views/admin/rooms/RoomRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import React, { useCallback } from 'react';

import { GenericTableCell, GenericTableRow } from '../../../components/GenericTable';
import { roomCoordinator } from '../../../lib/rooms/roomCoordinator';

Check failure on line 10 in apps/meteor/client/views/admin/rooms/RoomRow.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

There should be at least one empty line between import groups
import { useFormatDate } from '/client/hooks/useFormatDate';

Check failure on line 11 in apps/meteor/client/views/admin/rooms/RoomRow.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Unable to resolve path to module '/client/hooks/useFormatDate'

Check failure on line 11 in apps/meteor/client/views/admin/rooms/RoomRow.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Do not import modules using an absolute path

const roomTypeI18nMap = {
l: 'Omnichannel',
Expand All @@ -19,12 +20,13 @@
const getRoomDisplayName = (room: Pick<IRoom, RoomAdminFieldsType>): string | undefined =>
room.t === 'd' ? room.usernames?.join(' x ') : roomCoordinator.getRoomName(room.t, room);

const RoomRow = ({ room }: { room: Pick<IRoom, RoomAdminFieldsType> }) => {
const RoomRow = ({ room }: { room: Pick<IRoom, RoomAdminFieldsType> &{ts ?: Date}}) => {

Check failure on line 23 in apps/meteor/client/views/admin/rooms/RoomRow.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Replace `{ts·?:·Date}` with `·{·ts?:·Date·}·`
Aseem22 marked this conversation as resolved.
Show resolved Hide resolved
const t = useTranslation();
const mediaQuery = useMediaQuery('(min-width: 1024px)');
const router = useRouter();
const formatDate=useFormatDate();

Check failure on line 27 in apps/meteor/client/views/admin/rooms/RoomRow.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Replace `=` with `·=·`
Aseem22 marked this conversation as resolved.
Show resolved Hide resolved

const { _id, t: type, usersCount, msgs, default: isDefault, featured, ...args } = room;
const { _id, t: type, usersCount, msgs, default: isDefault, featured, ts, ...args } = room;
const icon = roomCoordinator.getRoomDirectives(room.t).getIcon?.(room);
const roomName = getRoomDisplayName(room);

Expand Down Expand Up @@ -83,6 +85,7 @@
{mediaQuery && <GenericTableCell withTruncatedText>{msgs}</GenericTableCell>}
{mediaQuery && <GenericTableCell withTruncatedText>{isDefault ? t('True') : t('False')}</GenericTableCell>}
{mediaQuery && <GenericTableCell withTruncatedText>{featured ? t('True') : t('False')}</GenericTableCell>}
{mediaQuery && ts && <GenericTableCell withTruncatedText>{formatDate(ts)}</GenericTableCell>}
</GenericTableRow>
);
};
Expand Down
12 changes: 11 additions & 1 deletion apps/meteor/client/views/admin/rooms/RoomsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

const prevRoomFilterText = useRef<string>(roomFilters.searchText);

const { sortBy, sortDirection, setSort } = useSort<'name' | 't' | 'usersCount' | 'msgs' | 'default' | 'featured'>('name');
const { sortBy, sortDirection, setSort } = useSort<'name' | 't' | 'usersCount' | 'msgs' | 'default' | 'featured'|'createdAt'>('name');

Check failure on line 37 in apps/meteor/client/views/admin/rooms/RoomsTable.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Replace `|` with `·|·`
const { current, itemsPerPage, setItemsPerPage, setCurrent, ...paginationProps } = usePagination();
const searchText = useDebouncedValue(roomFilters.searchText, 500);

Expand Down Expand Up @@ -109,6 +109,16 @@
>
{t('Featured')}
</GenericTableHeaderCell>
<GenericTableHeaderCell
key='createdAt'
direction={sortDirection}
active={sortBy === 'createdAt'}
onClick={setSort}
sort='createdAt'
w='x80'
>
{t('Created_at')}
</GenericTableHeaderCell>
</>
)}
</>
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/lib/rooms/adminFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
uids: 1,
avatarETag: 1,
federated: 1,
ts:1,

Check failure on line 31 in apps/meteor/lib/rooms/adminFields.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Insert `·`
} as const;
Loading