Skip to content

Commit 7f2134e

Browse files
committed
update
1 parent a90397f commit 7f2134e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rpimodeldecoder/src/app/page.tsx

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

3-
import { useState, useEffect } from 'react';
3+
import { useState, useEffect, useCallback } from 'react';
44
import { Cpu, Wifi, WifiOff, HardDrive, MemoryStick, Copy, Check } from 'lucide-react';
55

66
interface DecodedResult {
@@ -11,7 +11,7 @@ interface DecodedResult {
1111
color: string;
1212
}[];
1313
specs: {
14-
icon: React.ComponentType<any>;
14+
icon: React.ComponentType<{ className?: string }>;
1515
title: string;
1616
value: string;
1717
}[];
@@ -143,7 +143,7 @@ export default function Home() {
143143
};
144144
};
145145

146-
const decodeModel = (input: string) => {
146+
const decodeModel = useCallback((input: string) => {
147147
let code = input.toUpperCase().trim();
148148

149149
if (!code) {
@@ -179,15 +179,15 @@ export default function Home() {
179179
setResult(null);
180180
setError(true);
181181
}
182-
};
182+
}, [rplToCmMapping]);
183183

184184
const copyLink = async () => {
185185
const link = `${window.location.origin}${window.location.pathname}#${modelCode}`;
186186
try {
187187
await navigator.clipboard.writeText(link);
188188
setCopied(true);
189189
setTimeout(() => setCopied(false), 2000);
190-
} catch (err) {
190+
} catch {
191191
// Fallback for older browsers
192192
const textArea = document.createElement('textarea');
193193
textArea.value = link;
@@ -202,7 +202,7 @@ export default function Home() {
202202

203203
useEffect(() => {
204204
decodeModel(modelCode);
205-
}, [modelCode]);
205+
}, [modelCode, decodeModel]);
206206

207207
// Handle URL hash changes
208208
useEffect(() => {
@@ -280,7 +280,7 @@ export default function Home() {
280280
{/* Info Text */}
281281
<p className="text-gray-400 text-xs mt-4 max-w-md mx-auto">
282282
💡 Did you know? You can share direct links by adding the code to the URL:
283-
<code className="bg-gray-100 px-1 rounded text-gray-600">RaspberryModelCodeDecoder.raziksu.github.io/#CM4102008</code>
283+
<code className="bg-gray-100 px-1 rounded text-gray-600">razikus.github.io/RaspberryModelCodeDecoder/#CM4102008</code>
284284
</p>
285285
</div>
286286

0 commit comments

Comments
 (0)