b800dcd403
* style(ui): system-wide UX/UI polish pass — design-system conformance + copy cleanup Multi-agent scan of all 404 UI files against the locked design system, then 141 verified surgical fixes across 109 files (net -32 lines): - Remove forbidden elevation/motion: shadow-* and rounded-xl on cards, active:scale bounce, hover:shadow on list items, transition-all -> transition-colors. - Drop font-medium from single-weight Hedvig display headings/numerals. - Replace raw rainbow Tailwind status colors with Badge variants / brand tokens / neutral surfaces (achromatic chrome, semantic colors stay data-only). - Route raw dates through formatDate(), hand-rolled currency through formatCurrency(), add tabular-nums to financial figures; text-gray-* -> text-foreground tokens. - Swap hand-rolled skeletons for the Skeleton primitive; off-scale spacing -> token scale. - Fix copy: mislabeled "Leverantörsfakturor" -> "Utgifter" on bank-import outflow total, collapse no-op identical-branch ternaries, broken Swedish diacritics (mojibake), correct mismatch-password toast, correct supplier currency-field label. - Remove PII-leaking debug console.log on register, stray console.logs. Verified: tsc clean on all changed files, eslint clean, production build passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(auth): sanitize residual error logs in register flow Follow-up to PR review (compliance swarm V16 / GDPR Art.5(1)(f)): the remaining console.error calls in the register flow passed raw error objects, which Supabase may populate with PII (email) in nested fields. Log only sanitized message strings instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
125 lines
4.3 KiB
TypeScript
125 lines
4.3 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { Card, CardContent } from '@/components/ui/card'
|
|
import { Button } from '@/components/ui/button'
|
|
import { cn } from '@/lib/utils'
|
|
import { SECTORS } from '@/lib/extensions/sectors'
|
|
import { resolveIcon } from '@/lib/extensions/icon-resolver'
|
|
import { Briefcase, ArrowRight, Loader2 } from 'lucide-react'
|
|
|
|
interface Step2SectorSelectionProps {
|
|
onNext: (data: { sector_slug: string | null }) => void
|
|
onBack: () => void
|
|
isSaving: boolean
|
|
}
|
|
|
|
export default function Step2SectorSelection({ onNext, onBack, isSaving }: Step2SectorSelectionProps) {
|
|
const [selected, setSelected] = useState<string | null>(null)
|
|
|
|
const industrySectors = SECTORS.filter(s => s.slug !== 'general')
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div>
|
|
<h2 className="text-lg">Vilken bransch verkar du inom?</h2>
|
|
<p className="text-sm text-muted-foreground mt-1">
|
|
Vi anpassar verktyg och tillägg baserat på din bransch. Du kan alltid ändra detta senare.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
|
{industrySectors.map(sector => {
|
|
const Icon = resolveIcon(sector.icon)
|
|
const isSelected = selected === sector.slug
|
|
return (
|
|
<Card
|
|
key={sector.slug}
|
|
className={cn(
|
|
'cursor-pointer transition-colors',
|
|
isSelected
|
|
? 'border-primary ring-2 ring-primary/20'
|
|
: 'hover:border-primary/50'
|
|
)}
|
|
onClick={() => setSelected(sector.slug)}
|
|
>
|
|
<CardContent className="pt-6">
|
|
<div className="flex items-start gap-3">
|
|
<div className={cn(
|
|
'flex h-10 w-10 items-center justify-center rounded-lg flex-shrink-0',
|
|
isSelected ? 'bg-primary/10 text-primary' : 'bg-muted/50 text-muted-foreground'
|
|
)}>
|
|
<Icon className="h-5 w-5" />
|
|
</div>
|
|
<div>
|
|
<p className="text-sm font-medium">{sector.name}</p>
|
|
<p className="text-xs text-muted-foreground mt-0.5">{sector.description}</p>
|
|
<p className="text-xs text-muted-foreground mt-1">
|
|
{sector.extensions.length} branschverktyg
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
})}
|
|
|
|
{/* "Other" option */}
|
|
<Card
|
|
className={cn(
|
|
'cursor-pointer transition-all',
|
|
selected === 'other'
|
|
? 'border-primary ring-2 ring-primary/20'
|
|
: 'hover:border-primary/50'
|
|
)}
|
|
onClick={() => setSelected('other')}
|
|
>
|
|
<CardContent className="pt-6">
|
|
<div className="flex items-start gap-3">
|
|
<div className={cn(
|
|
'flex h-10 w-10 items-center justify-center rounded-lg flex-shrink-0',
|
|
selected === 'other' ? 'bg-primary/10 text-primary' : 'bg-muted/50 text-muted-foreground'
|
|
)}>
|
|
<Briefcase className="h-5 w-5" />
|
|
</div>
|
|
<div>
|
|
<p className="text-sm font-medium">Annan bransch</p>
|
|
<p className="text-xs text-muted-foreground mt-0.5">
|
|
Generella verktyg utan branschspecifika tillägg
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
|
|
<div className="flex items-center justify-between pt-4">
|
|
<div className="flex items-center gap-2">
|
|
<Button variant="ghost" onClick={onBack}>
|
|
Tillbaka
|
|
</Button>
|
|
<Button variant="ghost" onClick={() => onNext({ sector_slug: null })}>
|
|
Hoppa över
|
|
</Button>
|
|
</div>
|
|
<Button
|
|
onClick={() => onNext({ sector_slug: selected === 'other' ? null : selected })}
|
|
disabled={!selected || isSaving}
|
|
>
|
|
{isSaving ? (
|
|
<>
|
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
|
Sparar...
|
|
</>
|
|
) : (
|
|
<>
|
|
Nästa
|
|
<ArrowRight className="ml-2 h-4 w-4" />
|
|
</>
|
|
)}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|