Skip to content

Commit ebb3f24

Browse files
committed
lint
1 parent 0184d33 commit ebb3f24

File tree

3 files changed

+64
-49
lines changed

3 files changed

+64
-49
lines changed

components/feature/depex/PackageDetailsView.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,7 @@ export default function PackageDetailsView({
112112
<span className="md:hidden">{userEmail.split('@')[0]}</span>
113113
</Badge>
114114
)}
115-
<LanguageToggle
116-
currentLang={locale}
117-
onLanguageChange={onLocaleChange}
118-
/>
115+
<LanguageToggle currentLang={locale} onLanguageChange={onLocaleChange} />
119116
<ThemeToggle />
120117
{onLogout && (
121118
<Button onClick={onLogout} variant="outline" size="sm" className="px-2 sm:px-3">

components/feature/vexgen/TIXDetailsModal.tsx

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -388,50 +388,71 @@ export default function TIXDetailsModal({
388388
{artefact.artefact_name}
389389
</code>
390390
</div>
391-
391+
392392
{/* Sources */}
393-
{artefact.sources && artefact.sources.length > 0 && (
394-
<div className="mb-2">
395-
<p className="text-xs font-medium text-muted-foreground mb-1">
396-
{translations.tixDetailsModal?.sources || 'Sources'}:
397-
</p>
398-
<div className="flex flex-wrap gap-1">
399-
{artefact.sources.map((source: string, sourceIndex: number) => (
400-
<Badge
401-
key={sourceIndex}
402-
variant="outline"
403-
className="text-xs"
404-
>
405-
{source}
406-
</Badge>
407-
))}
393+
{artefact.sources &&
394+
artefact.sources.length > 0 && (
395+
<div className="mb-2">
396+
<p className="text-xs font-medium text-muted-foreground mb-1">
397+
{translations.tixDetailsModal
398+
?.sources || 'Sources'}
399+
:
400+
</p>
401+
<div className="flex flex-wrap gap-1">
402+
{artefact.sources.map(
403+
(
404+
source: string,
405+
sourceIndex: number
406+
) => (
407+
<Badge
408+
key={sourceIndex}
409+
variant="outline"
410+
className="text-xs"
411+
>
412+
{source}
413+
</Badge>
414+
)
415+
)}
416+
</div>
408417
</div>
409-
</div>
410-
)}
411-
418+
)}
419+
412420
{artefact.used_in_lines && (
413421
<div className="text-muted-foreground text-xs">
414-
{translations.tixDetailsModal?.lines || 'Lines'}:{' '}
415-
{typeof artefact.used_in_lines === 'string'
416-
? artefact.used_in_lines.split(',').map((line: string, lineIndex: number) => (
417-
<span
418-
key={lineIndex}
419-
className="inline-block bg-orange-100 text-orange-800 px-1 rounded mr-1 text-xs"
420-
>
421-
{line.trim()}
422-
</span>
423-
))
424-
: Array.isArray(artefact.used_in_lines)
425-
? artefact.used_in_lines.map((line: number) => (
426-
<span
427-
key={line}
428-
className="inline-block bg-orange-100 text-orange-800 px-1 rounded mr-1 text-xs"
429-
>
430-
{line}
431-
</span>
432-
))
433-
: null
434-
}
422+
{translations.tixDetailsModal
423+
?.lines || 'Lines'}
424+
:{' '}
425+
{typeof artefact.used_in_lines ===
426+
'string'
427+
? artefact.used_in_lines
428+
.split(',')
429+
.map(
430+
(
431+
line: string,
432+
lineIndex: number
433+
) => (
434+
<span
435+
key={lineIndex}
436+
className="inline-block bg-orange-100 text-orange-800 px-1 rounded mr-1 text-xs"
437+
>
438+
{line.trim()}
439+
</span>
440+
)
441+
)
442+
: Array.isArray(
443+
artefact.used_in_lines
444+
)
445+
? artefact.used_in_lines.map(
446+
(line: number) => (
447+
<span
448+
key={line}
449+
className="inline-block bg-orange-100 text-orange-800 px-1 rounded mr-1 text-xs"
450+
>
451+
{line}
452+
</span>
453+
)
454+
)
455+
: null}
435456
</div>
436457
)}
437458
</div>

components/layout/LanguageToggle.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212

1313
interface LanguageToggleProps {
1414
currentLang: 'en' | 'es'
15-
onLanguageChange?: (locale: 'en' | 'es') => void
15+
onLanguageChange?: (_locale: 'en' | 'es') => void
1616
}
1717

1818
export function LanguageToggle({ currentLang, onLanguageChange }: LanguageToggleProps) {
@@ -21,18 +21,15 @@ export function LanguageToggle({ currentLang, onLanguageChange }: LanguageToggle
2121

2222
const handleLanguageChange = (value: string) => {
2323
const newLang = value as 'en' | 'es'
24-
25-
// If a custom handler is provided, use it instead of router navigation
24+
2625
if (onLanguageChange) {
2726
onLanguageChange(newLang)
2827
return
2928
}
3029

31-
// Default behavior: navigate to new locale URL
3230
const pathWithoutLocale = pathname.replace(/^\/[a-z]{2}/, '')
3331
const newPath = `/${newLang}${pathWithoutLocale}`
3432

35-
// Preserve URL hash and search params
3633
const currentUrl = new URL(window.location.href)
3734
const search = currentUrl.search
3835
const hash = currentUrl.hash

0 commit comments

Comments
 (0)