Skip to content

Commit

Permalink
Enable current status in Module version card
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefwint committed Jan 22, 2024
1 parent 1c16ca4 commit b7a3d9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions src/components/Modules/ModuleVersionCard/ModuleVersionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ import {
getModulesModuleIdGetQueryKey,
useModulesModuleIdStatusPatch,
} from '@/api/fetchers'
import { ModuleStatus, ModuleStatusCode } from '@/api/fetchers.schemas'
import { ModuleStatusCode } from '@/api/fetchers.schemas'
import { toastNotification } from '@/utils/toastNotification'

interface ModuleVersionCardProps {
/** Current status of the module (optional) */
currentStatus?: ModuleStatus
}

const ModuleVersionCard = ({ currentStatus }: ModuleVersionCardProps) => {
const ModuleVersionCard = () => {
const queryClient = useQueryClient()

const { moduleId } = useParams()
Expand Down Expand Up @@ -74,11 +69,8 @@ const ModuleVersionCard = ({ currentStatus }: ModuleVersionCardProps) => {
ModuleStatusCode[code as keyof typeof ModuleStatusCode]
}`,
value: ModuleStatusCode[code as keyof typeof ModuleStatusCode],
isDisabled:
ModuleStatusCode[code as keyof typeof ModuleStatusCode] ===
currentStatus?.Status,
})),
[currentStatus?.Status]
[]
)

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/protected/Modules/ModuleDetail/ModuleDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const ModuleDetail = () => {
isLocked &&
!canComplete &&
(canPatchModuleStatus || isModuleManager) && (
<ModuleVersionCard currentStatus={module.Status} />
<ModuleVersionCard />
)}

{canComplete && isLocked && canPatchModuleStatus && (
Expand Down

0 comments on commit b7a3d9b

Please sign in to comment.