Skip to content

Commit 1416c61

Browse files
committed
cleanup, lint
1 parent 4685095 commit 1416c61

21 files changed

+43
-1406
lines changed

apps/dashboard/components/analytics/favicon-image.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import { GlobeIcon } from '@phosphor-icons/react';
4+
import Image from 'next/image';
45
import { useState } from 'react';
56

67
interface FaviconImageProps {
@@ -10,6 +11,9 @@ interface FaviconImageProps {
1011
className?: string;
1112
}
1213

14+
const hostnameRegex = /^https?:\/\//;
15+
const wwwRegex = /^www\./;
16+
1317
export function FaviconImage({
1418
domain,
1519
altText,
@@ -19,8 +23,8 @@ export function FaviconImage({
1923
const [error, setError] = useState(false);
2024

2125
const hostname = domain
22-
.replace(/^https?:\/\//, '')
23-
.replace(/^www\./, '')
26+
.replace(hostnameRegex, '')
27+
.replace(wwwRegex, '')
2428
.split('/')[0]
2529
.split('?')[0]
2630
.split('#')[0];
@@ -34,15 +38,15 @@ export function FaviconImage({
3438
hostname.includes('localhost') ||
3539
hostname.includes('127.0.0.1');
3640

37-
if (error || invalid) {
41+
if (invalid || error) {
3842
return (
3943
<div
4044
className={`${className} flex items-center justify-center rounded-sm`}
4145
style={{ width: size, height: size }}
4246
>
4347
<GlobeIcon
4448
aria-label={altText || 'Website icon'}
45-
className="text-muted-foreground"
49+
className="not-dark:text-primary text-muted-foreground"
4650
size={size}
4751
weight="duotone"
4852
/>
@@ -51,19 +55,12 @@ export function FaviconImage({
5155
}
5256

5357
return (
54-
<img
58+
<Image
5559
alt={altText || `${domain} favicon`}
5660
className={className}
5761
height={size}
5862
onError={() => setError(true)}
5963
src={`https://icons.duckduckgo.com/ip3/${hostname}.ico`}
60-
style={{
61-
width: size,
62-
height: size,
63-
objectFit: 'contain',
64-
imageRendering: '-webkit-optimize-contrast',
65-
filter: 'contrast(1.1) saturate(1.1)',
66-
}}
6764
width={size}
6865
/>
6966
);

apps/dashboard/components/atomic/FormattedNumber.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type React from 'react';
44
import { formatMetricNumber } from '@/lib/formatters';
55

66
interface FormattedNumberProps {
7-
id?: string; // Optional unique ID
7+
id?: string;
88
value: number;
99
className?: string;
1010
}

apps/dashboard/components/atomic/PageLinkCell.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use client';
22

3-
import { ExternalLinkIcon, FileTextIcon } from 'lucide-react'; // Using FileTextIcon as a generic page icon
3+
import { ArrowSquareOutIcon, FileTextIcon } from '@phosphor-icons/react';
44
import type React from 'react';
5-
import { formatDomainLink } from '@/app/(main)/websites/[id]/_components/utils/analytics-helpers'; // Adjusted path
5+
import { formatDomainLink } from '@/app/(main)/websites/[id]/_components/utils/analytics-helpers';
66
import { cn } from '@/lib/utils';
77

88
export interface PageLinkCellData {
@@ -50,15 +50,21 @@ export const PageLinkCell: React.FC<PageLinkCellProps> = ({
5050
rel={isExternal ? 'noopener noreferrer' : undefined}
5151
target={isExternal ? '_blank' : undefined}
5252
>
53-
<FileTextIcon className={cn('flex-shrink-0', iconClassName)} />
53+
<FileTextIcon
54+
className={cn('flex-shrink-0', iconClassName)}
55+
weight="duotone"
56+
/>
5457
<span
5558
className={cn('truncate group-hover:text-primary', textClassName)}
5659
style={{ maxWidth: `${maxLength + 2}ch` }}
5760
>
5861
{display}
5962
</span>
6063
{isExternal && (
61-
<ExternalLinkIcon className="h-3 w-3 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100" />
64+
<ArrowSquareOutIcon
65+
className="h-3 w-3 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"
66+
weight="duotone"
67+
/>
6268
)}
6369
</a>
6470
);

apps/dashboard/components/atomic/ReferrerSourceCell.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@
33
import type React from 'react';
44
import { FaviconImage } from '../analytics/favicon-image';
55

6-
// Mirroring the ReferrerItem type from WebsiteOverviewTab.tsx
7-
// Ideally, this would be a shared type if used in multiple places outside atomic components.
86
export interface ReferrerSourceCellData {
9-
// The primary display name, maps to 'value' if accessorKey is 'name' in a table
107
name?: string;
11-
// The raw referrer string
128
referrer?: string;
13-
// The domain used for fetching the favicon
149
domain?: string;
15-
// Optional unique ID for the component instance
1610
id?: string;
1711
}
1812

apps/dashboard/components/atomic/TrendArrow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use client';
22

33
import type React from 'react';
4-
import { cn } from '@/lib/utils'; // Assuming cn is available for class name composition
4+
import { cn } from '@/lib/utils';
55

66
interface TrendArrowProps {
77
id?: string;
8-
value: number; // Positive, negative, or zero
9-
invertColor?: boolean; // If true, positive is red, negative is green
8+
value: number;
9+
invertColor?: boolean;
1010
className?: string;
1111
}
1212

apps/dashboard/components/atomic/TrendPercentage.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { cn } from '@/lib/utils';
55

66
interface TrendPercentageProps {
77
id?: string;
8-
value: number; // The percentage value (e.g., 10.5, -5.2)
9-
invertColor?: boolean; // If true, positive is red, negative is green
8+
value: number;
9+
invertColor?: boolean;
1010
className?: string;
11-
digits?: number; // Number of digits after the decimal point
11+
digits?: number;
1212
}
1313

1414
const formatPercentage = (value: number, digits = 1): string => {
@@ -23,10 +23,9 @@ export const TrendPercentage: React.FC<TrendPercentageProps> = ({
2323
className,
2424
digits = 1,
2525
}) => {
26-
let colorClass = 'text-muted-foreground'; // Default for zero or NaN
26+
let colorClass = 'text-muted-foreground';
2727

2828
if (Number.isNaN(value)) {
29-
// Handle NaN case, perhaps display '--%'
3029
return (
3130
<span className={cn('text-muted-foreground', className)} id={id}>
3231
--%

apps/dashboard/components/auth/auth-card.tsx

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)