Loading frontend/src/components/Drive/DriveTable.tsx +23 −55 Original line number Diff line number Diff line import { Button } from '@blueprintjs/core' import { css } from '@emotion/css' import type { FileInfo } from '@inject/graphql' import type { Column } from '@inject/shared' import { dateSortingFunction, stringSortingFunction, Table, timedFormatter, } from '@inject/shared' import type { Column, Row } from '@inject/shared' import { stringSortingFunction, Table } from '@inject/shared' import type { NavigateOptions } from '@tanstack/react-router' import { useNavigate } from '@tanstack/react-router' import type { FC } from 'react' Loading @@ -29,12 +23,7 @@ const DriveTable: FC<DriveProps> = ({ }) => { const nav = useNavigate() const handleClick = ( e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, link: NavigateOptions ) => { e.preventDefault() const handleClick = (link: NavigateOptions) => { nav({ ...link, state: { Loading @@ -51,38 +40,19 @@ const DriveTable: FC<DriveProps> = ({ id: 'name', name: 'Name', style: { textAlign: 'left' }, renderValue: file => file.fileName, renderValue: file => ( <p className={css` margin: 0; padding-block: 0.5rem; `} > {file.fileName} </p> ), sortingFunction: (a, b) => stringSortingFunction(a.fileName, b.fileName), className: verticallyCentered, }, { id: 'uploaded', name: 'Uploaded', style: { textAlign: 'left', width: '20ch' }, renderValue: file => timedFormatter({ datetime: new Date(file.uploadedAt) }), sortingFunction: (a, b) => dateSortingFunction(new Date(a.uploadedAt), new Date(b.uploadedAt)), className: verticallyCentered, }, { id: 'actions', name: 'Actions', style: { textAlign: 'right', width: '14ch', }, renderValue: file => { const link = getFileLink(file.id) return ( <a href={link.href} onClick={e => handleClick(e, link)}> <Button icon='eye-open' title='Preview' /> </a> ) }, className: verticallyCentered, }, ] const filteredFiles = useMemo( Loading @@ -93,18 +63,16 @@ const DriveTable: FC<DriveProps> = ({ [fileInfos, searchString] ) const rows = useMemo( () => filteredFiles const rows: Row<FileInfo>[] = filteredFiles .map(fileInfo => ({ id: fileInfo.id, value: fileInfo, onClick: () => { const link = getFileLink(fileInfo.id) handleClick(link) }, })) .sort((a, b) => stringSortingFunction(a.value.fileName, b.value.fileName) ), [filteredFiles] ) .sort((a, b) => stringSortingFunction(a.value.fileName, b.value.fileName)) return ( <Table<FileInfo> Loading frontend/src/views/InstructorView/index.tsx +12 −7 Original line number Diff line number Diff line Loading @@ -105,13 +105,6 @@ export const InstructorView: FC<InstructorViewProps> = ({ {exerciseId && ( <OverviewButton exerciseId={exerciseId} hideLabel={hideLeftBar} /> )} <DriveButton link={{ to: InstructorDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> <MoveTimeButton hideLabel={hideLeftBar} exerciseId={exerciseId} Loading Loading @@ -151,6 +144,18 @@ export const InstructorView: FC<InstructorViewProps> = ({ </> ), }, { id: 'Documents', node: ( <DriveButton link={{ to: InstructorDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> ), }, ...(exerciseId && teamId ? [ { Loading frontend/src/views/TraineeView/index.tsx +13 −9 Original line number Diff line number Diff line Loading @@ -66,15 +66,6 @@ export const TraineeView: FC<TraineeViewProps> = ({ node: ( <> <HideSidebarButton /> {teamId && ( <DriveButton link={{ to: TraineeDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> )} <ExitButton exitRoute={{ to: RootRoute.to }} hideLabel={hideLeftBar} Loading @@ -82,8 +73,21 @@ export const TraineeView: FC<TraineeViewProps> = ({ </> ), }, ...(teamId ? [ { id: 'Documents', node: ( <DriveButton link={{ to: TraineeDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> ), }, { id: 'channels', name: 'Channels', Loading shared/components/Sidebar/DriveButton.tsx +2 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ export const DriveButton: FC<DriveButtonProps> = ({ link, hideLabel }) => ( alignText: 'left', fill: true, minimal: true, title: 'File drive', text: !hideLabel && 'File drive', title: 'Documents', text: !hideLabel && 'Documents', }} end /> Loading Loading
frontend/src/components/Drive/DriveTable.tsx +23 −55 Original line number Diff line number Diff line import { Button } from '@blueprintjs/core' import { css } from '@emotion/css' import type { FileInfo } from '@inject/graphql' import type { Column } from '@inject/shared' import { dateSortingFunction, stringSortingFunction, Table, timedFormatter, } from '@inject/shared' import type { Column, Row } from '@inject/shared' import { stringSortingFunction, Table } from '@inject/shared' import type { NavigateOptions } from '@tanstack/react-router' import { useNavigate } from '@tanstack/react-router' import type { FC } from 'react' Loading @@ -29,12 +23,7 @@ const DriveTable: FC<DriveProps> = ({ }) => { const nav = useNavigate() const handleClick = ( e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, link: NavigateOptions ) => { e.preventDefault() const handleClick = (link: NavigateOptions) => { nav({ ...link, state: { Loading @@ -51,38 +40,19 @@ const DriveTable: FC<DriveProps> = ({ id: 'name', name: 'Name', style: { textAlign: 'left' }, renderValue: file => file.fileName, renderValue: file => ( <p className={css` margin: 0; padding-block: 0.5rem; `} > {file.fileName} </p> ), sortingFunction: (a, b) => stringSortingFunction(a.fileName, b.fileName), className: verticallyCentered, }, { id: 'uploaded', name: 'Uploaded', style: { textAlign: 'left', width: '20ch' }, renderValue: file => timedFormatter({ datetime: new Date(file.uploadedAt) }), sortingFunction: (a, b) => dateSortingFunction(new Date(a.uploadedAt), new Date(b.uploadedAt)), className: verticallyCentered, }, { id: 'actions', name: 'Actions', style: { textAlign: 'right', width: '14ch', }, renderValue: file => { const link = getFileLink(file.id) return ( <a href={link.href} onClick={e => handleClick(e, link)}> <Button icon='eye-open' title='Preview' /> </a> ) }, className: verticallyCentered, }, ] const filteredFiles = useMemo( Loading @@ -93,18 +63,16 @@ const DriveTable: FC<DriveProps> = ({ [fileInfos, searchString] ) const rows = useMemo( () => filteredFiles const rows: Row<FileInfo>[] = filteredFiles .map(fileInfo => ({ id: fileInfo.id, value: fileInfo, onClick: () => { const link = getFileLink(fileInfo.id) handleClick(link) }, })) .sort((a, b) => stringSortingFunction(a.value.fileName, b.value.fileName) ), [filteredFiles] ) .sort((a, b) => stringSortingFunction(a.value.fileName, b.value.fileName)) return ( <Table<FileInfo> Loading
frontend/src/views/InstructorView/index.tsx +12 −7 Original line number Diff line number Diff line Loading @@ -105,13 +105,6 @@ export const InstructorView: FC<InstructorViewProps> = ({ {exerciseId && ( <OverviewButton exerciseId={exerciseId} hideLabel={hideLeftBar} /> )} <DriveButton link={{ to: InstructorDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> <MoveTimeButton hideLabel={hideLeftBar} exerciseId={exerciseId} Loading Loading @@ -151,6 +144,18 @@ export const InstructorView: FC<InstructorViewProps> = ({ </> ), }, { id: 'Documents', node: ( <DriveButton link={{ to: InstructorDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> ), }, ...(exerciseId && teamId ? [ { Loading
frontend/src/views/TraineeView/index.tsx +13 −9 Original line number Diff line number Diff line Loading @@ -66,15 +66,6 @@ export const TraineeView: FC<TraineeViewProps> = ({ node: ( <> <HideSidebarButton /> {teamId && ( <DriveButton link={{ to: TraineeDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> )} <ExitButton exitRoute={{ to: RootRoute.to }} hideLabel={hideLeftBar} Loading @@ -82,8 +73,21 @@ export const TraineeView: FC<TraineeViewProps> = ({ </> ), }, ...(teamId ? [ { id: 'Documents', node: ( <DriveButton link={{ to: TraineeDriveRoute.to, params: { exerciseId }, }} hideLabel={hideLeftBar} /> ), }, { id: 'channels', name: 'Channels', Loading
shared/components/Sidebar/DriveButton.tsx +2 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ export const DriveButton: FC<DriveButtonProps> = ({ link, hideLabel }) => ( alignText: 'left', fill: true, minimal: true, title: 'File drive', text: !hideLabel && 'File drive', title: 'Documents', text: !hideLabel && 'Documents', }} end /> Loading