fixes
All checks were successful
Build and Release / build (push) Successful in 15s
Build and Release / virus-total-check (push) Successful in 37s
Build and Release / release (push) Successful in 7s

This commit is contained in:
2025-08-26 22:11:42 -03:00
parent 377be6e8f6
commit d4c1884471
3 changed files with 13 additions and 2 deletions

12
App.tsx
View File

@@ -69,6 +69,14 @@ const App: React.FC = () => {
localStorage.setItem('config', JSON.stringify(config));
}, [config]);
useEffect(() => {
try {
localStorage.setItem('categories', JSON.stringify(categories));
} catch (error) {
console.error('Error saving categories to localStorage', error);
}
}, [categories]);
const handleSaveConfig = (newConfig: Config) => {
setConfig(newConfig);
setIsConfigModalOpen(false);
@@ -80,10 +88,11 @@ const App: React.FC = () => {
const handleSaveWebsite = (website: Partial<Website>) => {
if (editingWebsite) {
const idToUpdate = website.id ?? editingWebsite.id;
const newCategories = categories.map(category => ({
...category,
websites: category.websites.map(w =>
w.id === website.id ? { ...w, ...website } : w
w.id === idToUpdate ? { ...w, ...website, id: idToUpdate } : w
),
}));
setCategories(newCategories);
@@ -145,6 +154,7 @@ const App: React.FC = () => {
};
const handleMoveWebsite = (website: Website, direction: 'left' | 'right') => {
const categoryIndex = categories.findIndex(cat => cat.websites.some(w => w.id === website.id));
if (categoryIndex === -1) return;
const category = categories[categoryIndex];

View File

@@ -40,7 +40,7 @@ const CategoryEditModal: React.FC<CategoryEditModalProps> = ({ category, edit, o
)}
</div>
<div className="flex justify-end gap-4">
<button onClick={handleSave} className="bg-green-500 hover:bg-green-400 text-white font-bold py-2 px-6 rounded-lg">
<button onClick={() => onSave(name)} className="bg-green-500 hover:bg-green-400 text-white font-bold py-2 px-6 rounded-lg">
Save
</button>
<button onClick={onClose} className="bg-gray-600 hover:bg-gray-500 text-white font-bold py-2 px-6 rounded-lg">

View File

@@ -76,6 +76,7 @@ const WebsiteEditModal: React.FC<WebsiteEditModalProps> = ({ website, edit, onCl
};
const handleSave = () => {
console.log({ id: website?.id, name, url, icon });
onSave({ id: website?.id, name, url, icon });
};