feat: implement Figlet, Pastel, and Unit tools with a unified layout

- Add Figlet text converter with font selection and history
- Add Pastel color palette generator and manipulation suite
- Add comprehensive Units converter with category-based logic
- Introduce AppShell with Sidebar and Header for navigation
- Modernize theme system with CSS variables and new animations
- Update project configuration and dependencies
This commit is contained in:
2026-02-22 21:35:53 +01:00
parent ff6bb873eb
commit 2000623c67
540 changed files with 338653 additions and 809 deletions

53
lib/storage/history.ts Normal file
View File

@@ -0,0 +1,53 @@
'use client';
export interface HistoryItem {
id: string;
text: string;
font: string;
result: string;
timestamp: number;
}
const HISTORY_KEY = 'figlet-ui-history';
const MAX_HISTORY = 10;
export function getHistory(): HistoryItem[] {
if (typeof window === 'undefined') return [];
try {
const stored = localStorage.getItem(HISTORY_KEY);
return stored ? JSON.parse(stored) : [];
} catch {
return [];
}
}
export function addToHistory(text: string, font: string, result: string): void {
let history = getHistory();
const newItem: HistoryItem = {
id: `${Date.now()}-${Math.random()}`,
text,
font,
result,
timestamp: Date.now(),
};
// Add to beginning
history.unshift(newItem);
// Keep only MAX_HISTORY items
history = history.slice(0, MAX_HISTORY);
localStorage.setItem(HISTORY_KEY, JSON.stringify(history));
}
export function clearHistory(): void {
localStorage.removeItem(HISTORY_KEY);
}
export function removeHistoryItem(id: string): void {
const history = getHistory();
const filtered = history.filter(item => item.id !== id);
localStorage.setItem(HISTORY_KEY, JSON.stringify(filtered));
}