mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-22 02:13:59 +00:00
feat: adding translations
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user