feat: adding translations

This commit is contained in:
Chubby Granny Chaser
2025-11-30 03:15:27 +00:00
parent 8cb18578e0
commit 256d829a60
8 changed files with 42 additions and 22 deletions

View File

@@ -39,13 +39,16 @@
&__clear-text-button {
color: globals.$muted-color;
cursor: pointer;
padding: 2px 6px;
padding: 0;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
transition: color ease 0.2s;
background: transparent;
border: none;
&:hover {
color: #ffffff;
background-color: rgba(255, 255, 255, 0.15);
}
}

View File

@@ -142,7 +142,7 @@ export function SearchDropdown({
className="search-dropdown__clear-text-button"
onClick={onClearHistory}
>
clear
{t("clear_history")}
</button>
</div>
<ul className="search-dropdown__list">

View File

@@ -8,7 +8,6 @@ export interface SearchHistoryEntry {
}
const LEVELDB_KEY = "searchHistory";
const LEGACY_STORAGE_KEY = "search-history";
const MAX_HISTORY_ENTRIES = 15;
export function useSearchHistory() {
@@ -21,24 +20,10 @@ export function useSearchHistory() {
isInitialized.current = true;
try {
let data = (await levelDBService.get(LEVELDB_KEY, null, "json")) as
const data = (await levelDBService.get(LEVELDB_KEY, null, "json")) as
| SearchHistoryEntry[]
| null;
if (!data) {
const legacyData = localStorage.getItem(LEGACY_STORAGE_KEY);
if (legacyData) {
try {
const parsed = JSON.parse(legacyData) as SearchHistoryEntry[];
await levelDBService.put(LEVELDB_KEY, parsed, null, "json");
localStorage.removeItem(LEGACY_STORAGE_KEY);
data = parsed;
} catch {
localStorage.removeItem(LEGACY_STORAGE_KEY);
}
}
}
if (data) {
setHistory(data);
}