diff --git a/components/dashboard/DashboardContent.tsx b/components/dashboard/DashboardContent.tsx
index 242d5cd3..07b12ece 100644
--- a/components/dashboard/DashboardContent.tsx
+++ b/components/dashboard/DashboardContent.tsx
@@ -5,12 +5,6 @@ import Link from 'next/link'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { cn, formatCurrency } from '@/lib/utils'
-import {
- calculateEFTax,
- calculateABTax,
- getEnhancedTaxWarningStatus
-} from '@/lib/tax/calculator'
-import FSkattWarningCard from '@/components/dashboard/FSkattWarningCard'
import { UpcomingDeadlinesWidget } from '@/components/deadlines/UpcomingDeadlinesWidget'
import { TaxTodoWidget } from '@/components/deadlines/TaxTodoWidget'
import NewUserChecklist from '@/components/onboarding/NewUserChecklist'
@@ -77,18 +71,6 @@ export default function DashboardContent({ firstName, settings, summary, onboard
}, [])
const entityType = (settings?.entity_type as EntityType) || 'enskild_firma'
- const preliminaryTaxMonthly = settings?.preliminary_tax_monthly || 0
- const currentMonth = new Date().getMonth() + 1
- const preliminaryTaxPaidYTD = preliminaryTaxMonthly * currentMonth
-
- const totalTaxableIncome = summary.ytd.net
-
- const taxEstimate =
- entityType === 'enskild_firma'
- ? calculateEFTax(totalTaxableIncome, preliminaryTaxPaidYTD, null, summary.unpaidVatTotal)
- : calculateABTax(totalTaxableIncome, 0, preliminaryTaxPaidYTD, summary.unpaidVatTotal)
-
- const taxWarning = getEnhancedTaxWarningStatus(taxEstimate, preliminaryTaxMonthly, currentMonth)
const formatLargeNumber = (amount: number) => {
return new Intl.NumberFormat('sv-SE', {
@@ -492,14 +474,6 @@ export default function DashboardContent({ firstName, settings, summary, onboard
{showMore && (
- {/* F-skatt warning */}
-
- { window.location.href = '/settings' }}
- />
-
-
{/* Uncategorized transactions warning */}
{summary.uncategorizedCount > 0 && (summary.uncategorizedIncome > 0 || summary.uncategorizedExpenses > 0) && (
diff --git a/components/dashboard/FSkattWarningCard.tsx b/components/dashboard/FSkattWarningCard.tsx
deleted file mode 100644
index c33e64bb..00000000
--- a/components/dashboard/FSkattWarningCard.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-'use client'
-
-import { Card, CardContent } from '@/components/ui/card'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { InfoTooltip } from '@/components/ui/info-tooltip'
-import { formatCurrency } from '@/lib/utils'
-import {
- AlertTriangle,
- Info,
- CheckCircle,
- AlertCircle,
- TrendingUp,
- ChevronDown,
- ChevronUp,
-} from 'lucide-react'
-import { useState } from 'react'
-import type { TaxWarningStatus } from '@/types'
-
-interface FSkattWarningCardProps {
- warningStatus: TaxWarningStatus
- onAdjustClick?: () => void
-}
-
-export default function FSkattWarningCard({
- warningStatus,
- onAdjustClick,
-}: FSkattWarningCardProps) {
- const [isExpanded, setIsExpanded] = useState(false)
-
- // Don't show if everything is safe
- if (warningStatus.level === 'safe') {
- return null
- }
-
- // Icon and colors based on warning level
- const levelConfig = {
- safe: {
- icon: CheckCircle,
- iconColor: 'text-success',
- bgColor: 'bg-success/5',
- borderColor: 'border-success/50',
- badgeVariant: 'outline' as const,
- },
- info: {
- icon: Info,
- iconColor: 'text-primary',
- bgColor: 'bg-primary/5',
- borderColor: 'border-primary/20',
- badgeVariant: 'outline' as const,
- },
- warning: {
- icon: AlertTriangle,
- iconColor: 'text-warning',
- bgColor: 'bg-warning/5',
- borderColor: 'border-warning/50',
- badgeVariant: 'warning' as const,
- },
- danger: {
- icon: AlertCircle,
- iconColor: 'text-destructive',
- bgColor: 'bg-destructive/5',
- borderColor: 'border-destructive/50',
- badgeVariant: 'destructive' as const,
- },
- }
-
- const config = levelConfig[warningStatus.level]
- const Icon = config.icon
-
- return (
-
-
-
- {/* Main warning */}
-
-
-
-
-
- Vad betyder detta?
- Vi jämför din beräknade skatt med vad du betalat in via F-skatt hittills i år.
- Om du betalat för lite kan du få restskatt. Justera din månatliga F-skatt för att undvika överraskningar.
-
- }
- side="right"
- >
-
F-skatt varning
-
-
- {Math.round(warningStatus.percentageDifference * 100)}% skillnad
-
-
-
{warningStatus.message}
-
-
-
- {/* Expandable projection section */}
- {warningStatus.yearEndProjection && (
-
-
-
- {isExpanded && (
-
-
- Beräknad årsskatt
-
- {formatCurrency(warningStatus.yearEndProjection.estimatedTotalTax)}
-
-
-
- Projicerad inbetalning
-
- {formatCurrency(warningStatus.yearEndProjection.projectedPreliminaryPayments)}
-
-
-
- Projicerad skillnad
- 0
- ? 'text-destructive font-medium'
- : 'text-success font-medium'
- }
- >
- {warningStatus.yearEndProjection.projectedDifference > 0 ? '+' : ''}
- {formatCurrency(warningStatus.yearEndProjection.projectedDifference)}
-
-
-
- )}
-
- )}
-
- {/* Recommendation */}
- {warningStatus.recommendation && (
-
-
- Rekommendation:
- {warningStatus.recommendation}
-
-
- )}
-
- {/* Action button */}
- {onAdjustClick && (
-
-
-
- )}
-
-
-
- )
-}
diff --git a/lib/tax/calculator.ts b/lib/tax/calculator.ts
index 005dd1d2..6f8afc42 100644
--- a/lib/tax/calculator.ts
+++ b/lib/tax/calculator.ts
@@ -1,4 +1,4 @@
-import type { EntityType, TaxEstimate, TaxWarningLevel, TaxWarningStatus } from '@/types'
+import type { EntityType, TaxEstimate } from '@/types'
// Current Swedish tax rates (2026)
const TAX_RATES = {
@@ -13,14 +13,6 @@ const TAX_RATES = {
const STATE_TAX_THRESHOLD = 643100 // Taxable income above this gets +20% state tax
// Note: The "brytpunkt" is 660,400 kr but that includes grundavdrag
-// F-skatt warning thresholds (percentage difference)
-const WARNING_THRESHOLDS = {
- safe: 0.05, // < 5% difference
- info: 0.15, // 5-15% difference
- warning: 0.30, // 15-30% difference
- // > 30% = danger
-}
-
/**
* Calculate progressive grundavdrag (basic deduction) for 2026
* Based on Skatteverket's table - varies by income level
@@ -169,121 +161,6 @@ export function calculateAvailableBalance(
return Math.max(0, currentBalance - taxReservation)
}
-/**
- * Get tax warning status (legacy - simplified version)
- */
-export function getTaxWarningStatus(
- taxEstimate: TaxEstimate
-): { level: 'ok' | 'warning' | 'danger'; message: string } {
- const enhanced = getEnhancedTaxWarningStatus(taxEstimate, 0)
- // Map new levels to legacy format
- const levelMap: Record = {
- safe: 'ok',
- info: 'warning',
- warning: 'warning',
- danger: 'danger',
- }
- return {
- level: levelMap[enhanced.level],
- message: enhanced.message,
- }
-}
-
-/**
- * Get enhanced tax warning status with more detail
- * @param taxEstimate - Current tax estimate
- * @param preliminaryTaxMonthly - Monthly preliminary tax amount
- * @param currentMonth - Current month (1-12), defaults to current date
- */
-export function getEnhancedTaxWarningStatus(
- taxEstimate: TaxEstimate,
- preliminaryTaxMonthly: number,
- currentMonth: number = new Date().getMonth() + 1
-): TaxWarningStatus {
- // Calculate percentage difference
- const percentageDifference =
- taxEstimate.total_tax_liability > 0
- ? taxEstimate.difference / taxEstimate.total_tax_liability
- : 0
-
- // Determine warning level
- let level: TaxWarningLevel
- if (taxEstimate.difference <= 0) {
- level = 'safe'
- } else if (percentageDifference < WARNING_THRESHOLDS.safe) {
- level = 'safe'
- } else if (percentageDifference < WARNING_THRESHOLDS.info) {
- level = 'info'
- } else if (percentageDifference < WARNING_THRESHOLDS.warning) {
- level = 'warning'
- } else {
- level = 'danger'
- }
-
- // Calculate year-end projection
- const remainingMonths = 12 - currentMonth
- const projectedPreliminaryPayments =
- taxEstimate.preliminary_paid_ytd + preliminaryTaxMonthly * remainingMonths
-
- // Project total tax assuming same income rate
- const monthsElapsed = currentMonth
- const projectedAnnualIncome =
- monthsElapsed > 0
- ? (taxEstimate.total_tax_liability / monthsElapsed) * 12
- : taxEstimate.total_tax_liability
-
- const yearEndProjection = {
- estimatedTotalTax: Math.round(projectedAnnualIncome),
- projectedPreliminaryPayments: Math.round(projectedPreliminaryPayments),
- projectedDifference: Math.round(projectedAnnualIncome - projectedPreliminaryPayments),
- }
-
- // Generate message and recommendation
- let message: string
- let recommendation: string | undefined
-
- switch (level) {
- case 'safe':
- message = 'Du ligger bra till med din preliminärskatt'
- break
- case 'info':
- message = 'Din beräknade skatt är något högre än inbetald preliminärskatt'
- recommendation = `Överväg att öka din månatliga F-skatt med ca ${formatCurrency(
- Math.ceil((taxEstimate.difference / remainingMonths) * 1.1)
- )} för att undvika kvarskatt.`
- break
- case 'warning':
- message = `Du kan behöva betala ${formatCurrency(taxEstimate.difference)} extra i skatt`
- recommendation = `Vi rekommenderar att du höjer din månatliga F-skatt till ${formatCurrency(
- Math.ceil(preliminaryTaxMonthly + taxEstimate.difference / Math.max(remainingMonths, 1))
- )} för resten av året.`
- break
- case 'danger':
- message = `Stor skillnad! Du kan behöva betala ${formatCurrency(
- taxEstimate.difference
- )} extra i skatt vid deklaration`
- recommendation = `Kontakta Skatteverket för att justera din F-skatt. Nuvarande skillnad är ${Math.round(
- percentageDifference * 100
- )}% av beräknad skatt.`
- break
- }
-
- return {
- level,
- message,
- percentageDifference,
- yearEndProjection,
- recommendation,
- }
-}
-
-/**
- * Helper to format currency for messages
- */
-function formatCurrency(amount: number): string {
- return `${Math.round(amount).toLocaleString('sv-SE')} kr`
-}
-
/**
* Format tax breakdown for display
*/
diff --git a/types/index.ts b/types/index.ts
index 4bc48f52..19446e9f 100644
--- a/types/index.ts
+++ b/types/index.ts
@@ -1009,9 +1009,6 @@ export interface CreateFiscalPeriodInput {
period_end: string
}
-// Tax warning levels
-export type TaxWarningLevel = 'safe' | 'info' | 'warning' | 'danger'
-
// Onboarding progress for new user checklist
export interface OnboardingProgress {
hasCustomers: boolean
@@ -1020,19 +1017,6 @@ export interface OnboardingProgress {
hasBankConnected: boolean
}
-// Enhanced tax warning status
-export interface TaxWarningStatus {
- level: TaxWarningLevel
- message: string
- percentageDifference: number
- yearEndProjection?: {
- estimatedTotalTax: number
- projectedPreliminaryPayments: number
- projectedDifference: number
- }
- recommendation?: string
-}
-
// Onboarding step data
export interface OnboardingStepData {
step1?: {