Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/web/src/pages/admin/BuildingDetailAdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function FloorDialog({
)
}

function FloorCard({ floor, buildingId }: { floor: Floor; buildingId: string }) {
function FloorCard({ floor, buildingId }: { floor: Floor & { _count?: { zones: number } }; buildingId: string }) {
const navigate = useNavigate()
const qc = useQueryClient()
const fileRef = useRef<HTMLInputElement>(null)
Expand Down Expand Up @@ -175,12 +175,12 @@ function FloorCard({ floor, buildingId }: { floor: Floor; buildingId: string })
<div className="flex items-center gap-2 flex-wrap">
<p className="font-medium">{floor.name}</p>
<Badge variant="outline" className="text-xs">Level {floor.level}</Badge>
{(floor as any).floorPlan && (
{floor.floorPlan && (
<Badge variant="secondary" className="text-xs">Floor plan ✓</Badge>
)}
</div>
<p className="text-xs text-muted-foreground mt-0.5">
{(floor as any)._count?.zones ?? 0} zones
{floor._count?.zones ?? 0} zones
</p>
</div>
</div>
Expand All @@ -198,7 +198,7 @@ function FloorCard({ floor, buildingId }: { floor: Floor; buildingId: string })
onChange={(e) => {
const file = e.target.files?.[0]
if (!file) return
if ((floor as any).floorPlan) {
if (floor.floorPlan) {
setPendingUploadFile(file)
setReplaceConfirmOpen(true)
} else {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/pages/admin/FloorAdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,8 @@ export default function FloorAdminPage() {
[updateTransform],
)

const buildingId = (floor as any)?.building?.id
const buildingName = (floor as any)?.building?.name
const buildingId = floor?.building?.id
const buildingName = floor?.building?.name
const zones: ZoneData[] = (floor?.zones ?? []) as ZoneData[]
const totalDesks = zones.reduce((s, z) => s + (z.assets?.length ?? 0), 0)

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/admin/ReportsAdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ function ZoneUtilisationTable({ params }: { params: AnalyticsParams }) {
<ExportBtn onClick={() => downloadCsv('zone-utilisation.csv', [
['Building', 'Floor', 'Zone', 'Total', 'Bookable', 'Assigned', 'Disabled', 'Bookings', 'Utilisation %'],
...(data as UtilisationDataPoint[]).map((d) => [
(d as any).buildingName ?? '', d.floorName, d.zoneName,
d.buildingName ?? '', d.floorName, d.zoneName,
String(d.totalDesks), String(d.bookableDesks), String(d.assignedDesks), String(d.disabledDesks),
String(d.bookingCount), String(d.utilisationPct),
]),
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ export interface FloorSubscription {
export interface UtilisationDataPoint {
floorId: string
floorName: string
buildingId?: string
buildingName?: string
zoneId: string
zoneName: string
totalDesks: number
Expand Down
17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,25 @@ export default tseslint.config(
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// react-hooks/set-state-in-effect: pattern is valid in controlled sync effects
'react-hooks/set-state-in-effect': 'off',
// @eslint-react/set-state-in-effect is the same rule under a different plugin —
// turn it off too, consistent with the decision above.
'@eslint-react/set-state-in-effect': 'off',
// react-hooks/use-memo: non-inline callbacks are fine when extracted for readability
'react-hooks/use-memo': 'off',
// react-hook-form's watch()/control are React-compatible; this rule is a
// known false positive against that library's API.
'react-hooks/incompatible-library': 'off',
},
},

// Vendored shadcn/ui primitives — keep them as generated upstream (React.forwardRef,
// variant consts colocated with the component) rather than forking 30+ files away
// from the source they're maintained against.
{
files: ['apps/web/src/components/ui/**/*.{ts,tsx}'],
rules: {
'@eslint-react/no-forward-ref': 'off',
'react-refresh/only-export-components': 'off',
},
},
)
Loading