Skip to content

Commit

Permalink
linty lints
Browse files Browse the repository at this point in the history
  • Loading branch information
olemp committed Jan 24, 2025
1 parent 6f3a3e9 commit b778258
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion client/pages/Admin/WeekStatus/LockWeekButton/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './LockWeekButton'
export * from './useLockedPeriodsQuery'
export * from './useLockedPeriodsQuery'
18 changes: 10 additions & 8 deletions client/pages/Admin/WeekStatus/LockWeekButton/useLockWeekButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@ export function useLockWeekButton(props: ILockWeekButtonProps) {
const [lockPeriod] = useMutation(lockPeriodMutation)
const isLocked = useBoolean(false)
const [confirmationDialog, getResponse] = useConfirmationDialog()

useEffect(() => {
isLocked.setValue(
lockedPeriods?.some(
({ periodId }) => periodId === props.period?.id
)
lockedPeriods?.some(({ periodId }) => periodId === props.period?.id)
)
}, [lockedPeriods, props.period?.id])

const text = isLocked.value
? t('admin.weekStatus.unlockWeekButtonText')
: t('admin.weekStatus.lockWeekButtonText')

const icon = getFluentIcon(isLocked.value ? 'LockClosed' : 'LockOpen')

/**
Expand All @@ -44,10 +42,12 @@ export function useLockWeekButton(props: ILockWeekButtonProps) {
const onClick = async () => {
let reason = null
if (!isLocked.value) {
const {response,comment} = await getResponse({
const { response, comment } = await getResponse({
title: t('admin.weekStatus.confirmLockTitle'),
subText: t('admin.weekStatus.confirmLockSubText', {
period: props.period?.weekNumber + (props.period.monthName ? ` (${props.period.monthName})` : '')
period:
props.period?.weekNumber +
(props.period.monthName ? ` (${props.period.monthName})` : '')
}),
responses: [
[t('common.yes'), true, true],
Expand All @@ -67,7 +67,9 @@ export function useLockWeekButton(props: ILockWeekButtonProps) {
}
})
if (!data.result?.success) return
const period = props.period?.weekNumber + (props.period.monthName ? ` (${props.period.monthName})` : '')
const period =
props.period?.weekNumber +
(props.period.monthName ? ` (${props.period.monthName})` : '')
if (isLocked.value) {
displayToast(t('admin.weekStatus.weekUnlocked', { period }), 'success')
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import lockedPeriodsQuery from './locked-periods.gql'
* Hook for fetching locked periods.
*/
export function useLockedPeriodsQuery() {
const { data,loading } = useQuery<{ subscription: Subscription }>(lockedPeriodsQuery, {
fetchPolicy: 'network-only'
})
return [data?.subscription?.lockedPeriods,loading] as const
}
const { data, loading } = useQuery<{ subscription: Subscription }>(
lockedPeriodsQuery,
{
fetchPolicy: 'network-only'
}
)
return [data?.subscription?.lockedPeriods, loading] as const
}
2 changes: 1 addition & 1 deletion client/pages/Admin/WeekStatus/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './WeekStatus'
export * from './LockWeekButton'
export * from './types'
export * from './types'
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ export function useConfirmButtons(props: IConfirmButtonsProps) {
tooltipText =
selectedPeriod?.errors?.length > 0
? t('timesheet.unresolvedErrorText', {
count: selectedPeriod.errors.length
})
count: selectedPeriod.errors.length
})
: t('timesheet.hoursNotMatchedText', {
hours: $date.getDurationString(
selectedPeriod?.unmatchedDuration ?? 0,
t
)
})
hours: $date.getDurationString(
selectedPeriod?.unmatchedDuration ?? 0,
t
)
})
}
}

Expand Down

0 comments on commit b778258

Please sign in to comment.