Files
crewli/apps/app/src/stores/useShiftDetailStore.ts
bert.hausmans a7eaf0f948 style(app): apply eslint --fix to Tier 2 (TypeScript plumbing)
WS-3 session 1b-i Tier 2.

Scope: composables, lib, stores, plugins, types, utils, navigation,
main.ts. Mechanical fixes only — predominantly newline-before-return,
arrow-parens, antfu/if-newline, padding-line-between-statements, plus
one unicorn/prefer-includes (.some(p => x === p) → .includes(x))
in router guards.

Excludes (per session prompt):
- apps/app/vite.config.ts (Tier 3)
- apps/app/themeConfig.ts (Tier 3)
- apps/app/vitest.config.ts (Tier 3)
- All .vue files (already in Tier 1)

Hand-reviewed diffs for the three auth/router-critical files before
committing:
- src/lib/axios.ts: reviewed clean. Pure mechanical (quote-props on
  Accept header, curly-strip on single-statement ifs, one blank line
  before impersonationStore.clearState()). No type-import changes,
  no logic touched.
- src/stores/useAuthStore.ts: reviewed clean. curly-strip + padding
  before returns. The initialize()/doInitialize() race-condition guard
  on isInitialized is preserved verbatim.
- src/plugins/1.router/guards.ts: reviewed clean. if-newline reformat
  + one .some() → .includes() rewrite that's behaviorally identical
  for primitive equality on the guestOnlyPaths string array.

Tests + typecheck verified green post-fix:
- apps/app vitest: 49 passed (unchanged)
- apps/app vue-tsc: clean (unchanged)

Lint baseline progression:
- Pre-Tier-2: 422 problems (post-Tier-1)
- Post-Tier-2: 246 problems

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 11:06:46 +02:00

55 lines
1.5 KiB
TypeScript

import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { ShiftAssignment } from '@/types/shiftAssignment'
import { ShiftAssignmentStatus } from '@/types/shiftAssignment'
export const useShiftDetailStore = defineStore('shiftDetail', () => {
const isOpen = ref(false)
const selectedShiftId = ref<string | null>(null)
const selectedSectionId = ref<string | null>(null)
const selectedAssignmentIds = ref<string[]>([])
function openPanel(shiftId: string, sectionId: string) {
selectedShiftId.value = shiftId
selectedSectionId.value = sectionId
selectedAssignmentIds.value = []
isOpen.value = true
}
function closePanel() {
isOpen.value = false
selectedShiftId.value = null
selectedSectionId.value = null
selectedAssignmentIds.value = []
}
function toggleAssignmentSelection(id: string) {
const idx = selectedAssignmentIds.value.indexOf(id)
if (idx === -1)
selectedAssignmentIds.value.push(id)
else selectedAssignmentIds.value.splice(idx, 1)
}
function selectAllPending(assignments: ShiftAssignment[]) {
selectedAssignmentIds.value = assignments
.filter(a => a.status === ShiftAssignmentStatus.PENDING_APPROVAL)
.map(a => a.id)
}
function clearSelection() {
selectedAssignmentIds.value = []
}
return {
isOpen,
selectedShiftId,
selectedSectionId,
selectedAssignmentIds,
openPanel,
closePanel,
toggleAssignmentSelection,
selectAllPending,
clearSelection,
}
})