diff --git a/dictation_client/src/features/user/constants.ts b/dictation_client/src/features/user/constants.ts index 86f318c..27bb5dd 100644 --- a/dictation_client/src/features/user/constants.ts +++ b/dictation_client/src/features/user/constants.ts @@ -1,5 +1,3 @@ -import type { RoleType } from "./types"; - // LicenseStatusTypeの値を定数オブジェクトにする export const LICENSE_STATUS = { NORMAL: "Normal", @@ -13,16 +11,3 @@ export const LICENSE_ALLOCATE_STATUS = { ALLOCATED: "Allocated", NOTALLOCATED: "Not Allocated", } as const; - -// NoLicenseの表示 -export const NO_LICENSE = "No License" as const; - -// ライセンスが割り当てられている場合の表示 -export const LICENSE_NORMAL = "License Assigned" as const; - -// Roleの表示名 -export const ROLE_DISPLAY_NAME: Record = { - author: "Author", - typist: "Transcriptionist", - none: "None", -} as const; diff --git a/dictation_client/src/features/user/selectors.ts b/dictation_client/src/features/user/selectors.ts index 8cd9bdf..de7e2ee 100644 --- a/dictation_client/src/features/user/selectors.ts +++ b/dictation_client/src/features/user/selectors.ts @@ -9,11 +9,7 @@ import { isLicenseStatusType, isRoleType, } from "./types"; -import { - LICENSE_STATUS, - LICENSE_ALLOCATE_STATUS, - ROLE_DISPLAY_NAME, -} from "./constants"; +import { LICENSE_STATUS, LICENSE_ALLOCATE_STATUS } from "./constants"; export const selectInputValidationErrors = (state: RootState) => { const { name, email, role, authorId, encryption, encryptionPassword } = @@ -180,8 +176,7 @@ export const selectUserViews = (state: RootState): UserView[] => { prompt: convertedValues.prompt, encryption: convertedValues.encryption, authorId: convertedValues.authorId, - // roleに応じて表示名を変更する - role: ROLE_DISPLAY_NAME[role], + role, licenseStatus: convertedLicenseStatus, expiration: convertedExpiration, remaining: convertedRemaining, diff --git a/dictation_client/src/pages/DictationPage/index.tsx b/dictation_client/src/pages/DictationPage/index.tsx index d9c5c4f..e5769a8 100644 --- a/dictation_client/src/pages/DictationPage/index.tsx +++ b/dictation_client/src/pages/DictationPage/index.tsx @@ -439,8 +439,9 @@ const DictationPage: React.FC = (): JSX.Element => { dispatch(listTypistsAsync()); dispatch(listTypistGroupsAsync()); - const url = `${import.meta.env.VITE_DESK_TOP_APP_SCHEME - }:playback?audioId=${audioFileId}`; + const url = `${ + import.meta.env.VITE_DESK_TOP_APP_SCHEME + }:playback?audioId=${audioFileId}`; const a = document.createElement("a"); a.href = url; document.body.appendChild(a); @@ -922,6 +923,41 @@ const DictationPage: React.FC = (): JSX.Element => { })(); }, [dispatch]); + const getTaskStatus = (taskStatus: string): string => { + switch (taskStatus) { + case STATUS.UPLOADED: + return t(getTranslationID("dictationPage.label.uploaded")); + case STATUS.PENDING: + return t(getTranslationID("dictationPage.label.pending")); + case STATUS.FINISHED: + return t(getTranslationID("dictationPage.label.finished")); + case STATUS.INPROGRESS: + return t(getTranslationID("dictationPage.label.inProgress")); + case STATUS.BACKUP: + return t(getTranslationID("dictationPage.label.backup")); + default: + return taskStatus; + } + }; + + const getTaskStatusIcon = (taskStatus: string): JSX.Element => { + switch (taskStatus) { + case STATUS.UPLOADED: + return Uploaded; + case STATUS.PENDING: + return Pending; + case STATUS.FINISHED: + return Finished; + case STATUS.INPROGRESS: + return InProgress; + case STATUS.BACKUP: + return Backup; + default: + // 予期せぬステータスの場合、アイコンを表示しない + return ; + } + }; + return ( <> @@ -1098,8 +1134,9 @@ const DictationPage: React.FC = (): JSX.Element => { {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}