This commit is contained in:
Kelvin 2025-03-04 19:53:30 -03:00 committed by GitHub
commit 99a8809a22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 256 additions and 5 deletions

View file

@ -255,6 +255,12 @@
"download_sources_description": "سيقوم Hydra بجلب روابط التنزيل من هذه المصادر. يجب أن يكون عنوان URL للمصدر رابطًا مباشرًا لملف .json يحتوي على روابط التنزيل.",
"validate_download_source": "تحقق",
"remove_download_source": "إزالة",
"removed_download_sources": "تمت إزالة مصادر التنزيل",
"cancel_button_confirmation_delete_all_sources": "لا",
"confirm_button_confirmation_delete_all_sources": "نعم، احذف كل شيء",
"description_confirmation_delete_all_sources": "سوف تقوم بحذف جميع مصادر التنزيل",
"title_confirmation_delete_all_sources": "احذف جميع مصادر التنزيل",
"button_delete_all_sources": "قم بإزالة جميع مصادر التنزيل",
"add_download_source": "إضافة مصدر",
"download_count_zero": "لا توجد خيارات تنزيل",
"download_count_one": "{{countFormatted}} خيار تنزيل",

View file

@ -107,6 +107,12 @@
"notifications": "Апавяшчэнні",
"enable_download_notifications": "Па сканчэнні сцягванні",
"enable_repack_list_notifications": "Пры даданні новага рэпака",
"cancel_button_confirmation_delete_all_sources": "Няма",
"confirm_button_confirmation_delete_all_sources": "Так,выдаліць усё",
"description_confirmation_delete_all_sources": "Вы выдаліце ​​ўсе крыніцы сцягвання",
"title_confirmation_delete_all_sources": "Выдаліць усе крыніцы сцягвання",
"removed_download_sources": "Крыніцы сцягвання выдалены",
"button_delete_all_sources": "Премахнете всички източници на изтегляне",
"behavior": "Паводзіны",
"quit_app_instead_hiding": "Закрываць праграму замест таго, каб хаваць яе ў трэй",
"launch_with_system": "Запускаць праграму пры запуску сыстэмы"

View file

@ -253,6 +253,12 @@
"download_source_errored": "Сгрешен",
"sync_download_sources": "Синхронизирай източниците",
"removed_download_source": "Източника за сваляне е премахнат",
"cancel_button_confirmation_delete_all_sources": "не",
"confirm_button_confirmation_delete_all_sources": "Да, удалить все",
"description_confirmation_delete_all_sources": "Вы удалите все источники загрузки",
"title_confirmation_delete_all_sources": "Удалить все источники загрузки",
"removed_download_sources": "Шрифты удалены",
"button_delete_all_sources": "Удалить все источники загрузки",
"added_download_source": "Добавен източник за сваляне",
"download_sources_synced": "Всички източници за сваляне са синхронизирани",
"insert_valid_json_url": "Добавете ваиден JSON линк",

View file

@ -175,6 +175,12 @@
"download_sources_description": "Hydra buscarà els enllaços de descàrrega d'aquestes fonts. L'URL d'origen ha de ser un enllaç directe a un fitxer .json que contingui els enllaços de descàrrega.",
"validate_download_source": "Valida",
"remove_download_source": "Elimina",
"cancel_button_confirmation_delete_all_sources": "No",
"confirm_button_confirmation_delete_all_sources": "Sí, esborra-ho tot",
"description_confirmation_delete_all_sources": "Eliminareu totes les fonts de descàrrega",
"title_confirmation_delete_all_sources": "Suprimeix totes les fonts de baixada",
"removed_download_sources": "S'han eliminat les fonts de descàrrega",
"button_delete_all_sources": "Elimina totes les fonts de baixada",
"add_download_source": "Afegeix font",
"download_count_zero": "No hi ha baixades a la llista",
"download_count_one": "{{countFormatted}} a la llista de baixades",

View file

@ -237,6 +237,12 @@
"download_source_errored": "Chyba",
"sync_download_sources": "Synchronizovat zdroje",
"removed_download_source": "Zdroj odebrán",
"cancel_button_confirmation_delete_all_sources": "Žádný",
"confirm_button_confirmation_delete_all_sources": "Ano, smazat vše",
"description_confirmation_delete_all_sources": "Smažete všechny zdroje stahování",
"title_confirmation_delete_all_sources": "Odstraňte všechny zdroje stahování",
"removed_download_sources": "Zdroje stahování byly odstraněny",
"button_delete_all_sources": "Odstraňte všechny zdroje stahování",
"added_download_source": "Zdroj přidán",
"download_sources_synced": "Všechny zdroje jsou synchronizovány",
"insert_valid_json_url": "Zadej platnou JSON adresu",

View file

@ -201,6 +201,12 @@
"download_source_errored": "Fejlede",
"sync_download_sources": "Synkronisér kilder",
"removed_download_source": "Download kilde fjernet",
"cancel_button_confirmation_delete_all_sources": "Ingen",
"confirm_button_confirmation_delete_all_sources": "Ja, slet alt",
"description_confirmation_delete_all_sources": "Du vil slette alle downloadkilder",
"title_confirmation_delete_all_sources": "Slet alle downloadkilder",
"removed_download_sources": "Download kilder fjernet",
"button_delete_all_sources": "Fjern alle downloadkilder",
"added_download_source": "Tilføjede download kilde",
"download_sources_synced": "Alle download kilder er synkroniserede",
"insert_valid_json_url": "Indsæt en gyldig JSON url",

View file

@ -185,6 +185,12 @@
"download_source_errored": "Fehlgeschlagen",
"sync_download_sources": "Quellen synchronisieren",
"removed_download_source": "Download-Quelle entfernt",
"cancel_button_confirmation_delete_all_sources": "Nein",
"confirm_button_confirmation_delete_all_sources": "Ja, alles löschen",
"description_confirmation_delete_all_sources": "Du löschen alle Downloadquellen",
"title_confirmation_delete_all_sources": "Löschen du alle Downloadquellen",
"removed_download_sources": "Download-Quellen entfernt",
"button_delete_all_sources": "Entfernen Sie alle Downloadquellen",
"added_download_source": "Download-Quelle hinzugefügt",
"download_sources_synced": "Alle Download-Quellen sind synchronisiert",
"insert_valid_json_url": "Füge eine gültige JSON URL ein",

View file

@ -265,6 +265,12 @@
"download_source_errored": "Errored",
"sync_download_sources": "Sync sources",
"removed_download_source": "Download source removed",
"removed_download_sources": "Download sources removed",
"cancel_button_confirmation_delete_all_sources": "No",
"confirm_button_confirmation_delete_all_sources": "Yes, delete everything",
"title_confirmation_delete_all_sources": "Delete all download sources",
"description_confirmation_delete_all_sources": "You will delete all download sources",
"button_delete_all_sources": "Remove all download sources",
"added_download_source": "Added download source",
"download_sources_synced": "All download sources are synced",
"insert_valid_json_url": "Insert a valid JSON url",

View file

@ -259,6 +259,12 @@
"download_source_errored": "Error",
"sync_download_sources": "Sincronizar fuentes",
"removed_download_source": "Fuente de descarga eliminada",
"cancel_button_confirmation_delete_all_sources": "No",
"confirm_button_confirmation_delete_all_sources": "Sí, eliminar todo",
"description_confirmation_delete_all_sources": "Eliminarás todas las fuentes de descarga",
"title_confirmation_delete_all_sources": "Eliminar todas las fuentes de descarga",
"removed_download_sources": "Fuentes de descarga eliminadas",
"button_delete_all_sources": "Eliminar todas las fuentes de descarga",
"added_download_source": "Fuente de descarga añadida",
"download_sources_synced": "Todas las fuentes de descargas están actualizadas.",
"insert_valid_json_url": "Introduce una URL JSON válida",

View file

@ -236,6 +236,12 @@
"download_source_errored": "Vigane",
"sync_download_sources": "Sünkroniseeri allikad",
"removed_download_source": "Allalaadimise allikas eemaldatud",
"cancel_button_confirmation_delete_all_sources": "Ei",
"confirm_button_confirmation_delete_all_sources": "Jah, kustuta kõik",
"description_confirmation_delete_all_sources": "Kustutate kõik allalaadimisallikad",
"title_confirmation_delete_all_sources": "Kustutage kõik allalaadimisallikad",
"removed_download_sources": "Allalaadimise allikas eemaldati",
"button_delete_all_sources": "Eemaldage kõik allalaadimisallikad",
"added_download_source": "Allalaadimise allikas lisatud",
"download_sources_synced": "Kõik allalaadimise allikad on sünkroniseeritud",
"insert_valid_json_url": "Sisesta kehtiv JSON url",

View file

@ -111,6 +111,12 @@
"launch_with_system": "زمانی که سیستم روشن می‌شود، هایدرا را باز کن",
"general": "کلی",
"behavior": "رفتار",
"cancel_button_confirmation_delete_all_sources": "خیر",
"confirm_button_confirmation_delete_all_sources": "ہاں، سب کچھ حذف کر دیں۔",
"description_confirmation_delete_all_sources": "آپ ڈاؤن لوڈ کے تمام ذرائع کو حذف کر دیں گے۔",
"title_confirmation_delete_all_sources": "تمام منابع دانلود را حذف کنید",
"removed_download_sources": "منابع دانلود حذف شد",
"button_delete_all_sources": "تمام منابع دانلود را حذف کنید",
"enable_real_debrid": "فعال‌سازی Real-Debrid",
"debrid_api_token_hint": "کلید API خود را از <ب0>اینجا</0> بگیرید.",
"save_changes": "ذخیره تغییرات"

View file

@ -99,7 +99,13 @@
"notifications": "Notifications",
"enable_download_notifications": "Quand un téléchargement est terminé",
"enable_repack_list_notifications": "Quand un nouveau repack est ajouté",
"language": "Langue"
"language": "Langue",
"cancel_button_confirmation_delete_all_sources": "Non",
"confirm_button_confirmation_delete_all_sources": "Oui, tout supprimer",
"description_confirmation_delete_all_sources": "Vous supprimerez toutes les sources de téléchargement",
"title_confirmation_delete_all_sources": "Supprimer toutes les sources de téléchargement",
"removed_download_sources": "Sources de téléchargement supprimées",
"button_delete_all_sources": "Supprimer toutes les sources de téléchargement"
},
"notifications": {
"download_complete": "Téléchargement terminé",

View file

@ -106,6 +106,12 @@
"change": "Frissítés",
"notifications": "Értesítések",
"enable_download_notifications": "Amikor egy letöltés befejeződik",
"cancel_button_confirmation_delete_all_sources": "Nem",
"confirm_button_confirmation_delete_all_sources": "Igen, törölj mindent",
"description_confirmation_delete_all_sources": "Törölni fog minden letöltési forrást",
"title_confirmation_delete_all_sources": "Törölje az összes letöltési forrást",
"removed_download_sources": "Betűtípusok eltávolítva",
"button_delete_all_sources": "Távolítsa el az összes letöltési forrást",
"enable_repack_list_notifications": "Amikor egy új repack hozzáadásra kerül"
},
"notifications": {

View file

@ -175,6 +175,12 @@
"download_sources_description": "Hydra akan mencari link unduhan dari sini. URL harus menuju file .json dengan link unduhan.",
"validate_download_source": "Validasi",
"remove_download_source": "Hapus",
"cancel_button_confirmation_delete_all_sources": "TIDAK",
"confirm_button_confirmation_delete_all_sources": "Ya, hapus semuanya",
"description_confirmation_delete_all_sources": "Anda akan menghapus semua sumber unduhan",
"title_confirmation_delete_all_sources": "Hapus semua sumber unduhan",
"removed_download_sources": "Font dihapus",
"button_delete_all_sources": "Hapus semua sumber unduhan",
"add_download_source": "Tambahkan sumber",
"download_count_zero": "Tidak ada unduhan dalam daftar",
"download_count_one": "{{countFormatted}} unduhan dalam daftar",

View file

@ -120,6 +120,12 @@
"general": "Generale",
"behavior": "Comportamento",
"enable_real_debrid": "Abilita Real Debrid",
"cancel_button_confirmation_delete_all_sources": "NO",
"confirm_button_confirmation_delete_all_sources": "Sì, cancella tutto",
"description_confirmation_delete_all_sources": "Eliminerai tutte le fonti di download",
"title_confirmation_delete_all_sources": "Elimina tutte le fonti di download",
"removed_download_sources": "Fonti di download rimosse",
"button_delete_all_sources": "Rimuovi tutte le fonti di download",
"debrid_api_token_hint": "Puoi trovare la tua chiave API <0>here</0>",
"save_changes": "Salva modifiche"
},

View file

@ -173,6 +173,12 @@
"download_sources_description": "Hydra осы көздерден жүктеу сілтемелерін алады. URL-да жүктеу сілтемелері бар .json файлына тікелей сілтеме болуы керек.",
"validate_download_source": "Тексеру",
"remove_download_source": "Жою",
"cancel_button_confirmation_delete_all_sources": "Жоқ",
"confirm_button_confirmation_delete_all_sources": "Иә, бәрін жойыңыз",
"description_confirmation_delete_all_sources": "Барлық жүктеу көздерін жоясыз",
"title_confirmation_delete_all_sources": "Барлық жүктеу көздерін жойыңыз",
"removed_download_sources": "Қаріптер жойылды",
"button_delete_all_sources": "Барлық жүктеу көздерін жойыңыз",
"add_download_source": "Жүктеу көзін қосу",
"download_count_zero": "Жүктеулер тізімінде жоқ",
"download_count_one": "{{countFormatted}} жүктеу тізімде",

View file

@ -111,6 +111,12 @@
"launch_with_system": "컴퓨터가 시작되었을 때 Hydra 실행",
"general": "일반",
"behavior": "행동",
"cancel_button_confirmation_delete_all_sources": "아니요",
"confirm_button_confirmation_delete_all_sources": "네, 모두 삭제합니다",
"description_confirmation_delete_all_sources": "모든 다운로드 소스를 삭제합니다.",
"title_confirmation_delete_all_sources": "모든 다운로드 소스 삭제",
"removed_download_sources": "제거된 글꼴",
"button_delete_all_sources": "모든 다운로드 소스 제거",
"enable_real_debrid": "Real-Debrid 활성화",
"debrid_api_token_hint": "API 키를 <0>이곳</0>에서 얻으세요.",
"save_changes": "변경 사항 저장"

View file

@ -201,6 +201,12 @@
"download_source_errored": "Mislyktes",
"sync_download_sources": "Synkroniser kilder",
"removed_download_source": "Nedlastingskilde fjernet",
"cancel_button_confirmation_delete_all_sources": "Ingen",
"confirm_button_confirmation_delete_all_sources": "Ja, slett alt",
"description_confirmation_delete_all_sources": "Du vil slette alle nedlastingskilder",
"title_confirmation_delete_all_sources": "Slett alle nedlastingskilder",
"removed_download_sources": "Fonter fjernet",
"button_delete_all_sources": "Fjern alle nedlastingskilder",
"added_download_source": "La til Nedlastingskilde",
"download_sources_synced": "Alle nedlastingskilder er synkroniserte",
"insert_valid_json_url": "Innsett en gyldig JSON url",

View file

@ -112,6 +112,12 @@
"launch_with_system": "Start Hydra bij het opstarten van het systeem",
"general": "Algemeen",
"behavior": "Gedrag",
"cancel_button_confirmation_delete_all_sources": "Nee",
"confirm_button_confirmation_delete_all_sources": "Ja, verwijder alles",
"description_confirmation_delete_all_sources": "Je verwijdert alle downloadbronnen",
"title_confirmation_delete_all_sources": "Verwijder alle downloadbronnen",
"removed_download_sources": "Downloadbronnen verwijderd",
"button_delete_all_sources": "Verwijder alle downloadbronnen",
"enable_real_debrid": "Enable Real-Debrid",
"debrid_api_token_hint": "U kunt uw API-sleutel <0>hier</0> verkrijgen.",
"save_changes": "Wijzigingen opslaan"

View file

@ -120,6 +120,11 @@
"general": "Ogólne",
"behavior": "Zachowania",
"language": "Język",
"cancel_button_confirmation_delete_all_sources": "NIE",
"confirm_button_confirmation_delete_all_sources": "Tak, usuń wszystko",
"description_confirmation_delete_all_sources": "Usuniesz wszystkie źródła pobierania",
"title_confirmation_delete_all_sources": "Usuń wszystkie źródła pobierania",
"button_delete_all_sources": "Usuń wszystkie źródła pobierania",
"enable_real_debrid": "Włącz Real-Debrid",
"debrid_api_token_hint": "Możesz uzyskać swój klucz API <0>tutaj</0>",
"save_changes": "Zapisz zmiany"

View file

@ -255,6 +255,12 @@
"download_source_errored": "Falhou",
"sync_download_sources": "Sincronizar",
"removed_download_source": "Fonte removida",
"removed_download_sources": "Fontes removidas",
"cancel_button_confirmation_delete_all_sources": "Não",
"confirm_button_confirmation_delete_all_sources": "Sim, excluir tudo",
"title_confirmation_delete_all_sources": "Excluir todas as fontes de download",
"description_confirmation_delete_all_sources": "Você irá excluir todas as fontes de download",
"button_delete_all_sources": "Remover todas as fontes de download",
"added_download_source": "Fonte adicionada",
"download_sources_synced": "As fontes foram sincronizadas",
"insert_valid_json_url": "Insira a url de um JSON válido",

View file

@ -232,6 +232,12 @@
"download_source_errored": "Falhou",
"sync_download_sources": "Sincronizar",
"removed_download_source": "Fonte removida",
"cancel_button_confirmation_delete_all_sources": "Não",
"confirm_button_confirmation_delete_all_sources": "Sim, apague tudo",
"description_confirmation_delete_all_sources": "Irá eliminar todas as fontes de download",
"title_confirmation_delete_all_sources": "Apague todas as fontes de download",
"removed_download_sources": "Fontes de download removidas",
"button_delete_all_sources": "Remover todas as fontes de download",
"added_download_source": "Fonte adicionada",
"download_sources_synced": "As fontes foram sincronizadas",
"insert_valid_json_url": "Insere o URL de um JSON válido",

View file

@ -127,6 +127,12 @@
"behavior": "Comportament",
"language": "Limbă",
"api_token": "Token API",
"cancel_button_confirmation_delete_all_sources": "Nu",
"confirm_button_confirmation_delete_all_sources": "Da, șterge totul",
"description_confirmation_delete_all_sources": "Veți șterge toate sursele de descărcare",
"title_confirmation_delete_all_sources": "Ștergeți toate sursele de descărcare",
"removed_download_sources": "Sursele de descărcare au fost eliminate",
"button_delete_all_sources": "Eliminați toate sursele de descărcare",
"enable_real_debrid": "Activează Real-Debrid",
"real_debrid_description": "Real-Debrid este un descărcător fără restricții care îți permite să descarci fișiere instantaneu și la cea mai bună viteză a internetului tău.",
"debrid_invalid_token": "Token API invalid",

View file

@ -266,6 +266,12 @@
"download_source_errored": "Ошибка",
"sync_download_sources": "Обновить источники",
"removed_download_source": "Источник загрузок удален",
"cancel_button_confirmation_delete_all_sources": "Нет",
"confirm_button_confirmation_delete_all_sources": "Да, удалить все",
"description_confirmation_delete_all_sources": "Вы удалите все источники загрузки",
"title_confirmation_delete_all_sources": "Удалить все источники загрузки",
"removed_download_sources": "Шрифты удалены",
"button_delete_all_sources": "Удалить все источники загрузки",
"added_download_source": "Источник загрузок добавлен",
"download_sources_synced": "Все источники загрузок синхронизированы",
"insert_valid_json_url": "Вставьте действительный URL JSON-файла",

View file

@ -250,6 +250,12 @@
"validate_download_source": "Doğrula",
"remove_download_source": "Kaldır",
"add_download_source": "Kaynak ekle",
"cancel_button_confirmation_delete_all_sources": "HAYIR",
"confirm_button_confirmation_delete_all_sources": "Evet, her şeyi sil",
"description_confirmation_delete_all_sources": "Tüm indirme kaynaklarını sileceksiniz",
"title_confirmation_delete_all_sources": "Tüm indirme kaynaklarını sil",
"removed_download_sources": "Yazı tipleri kaldırıldı",
"button_delete_all_sources": "Tüm indirme kaynaklarını kaldır",
"download_count_zero": "İndirme seçeneği yok",
"download_count_one": "{{countFormatted}} indirme seçeneği",
"download_count_other": "{{countFormatted}} indirme seçeneği",

View file

@ -176,6 +176,12 @@
"import": "Імпортувати",
"insert_valid_json_url": "Вставте дійсний URL JSON-файлу",
"language": "Мова",
"cancel_button_confirmation_delete_all_sources": "немає",
"confirm_button_confirmation_delete_all_sources": "Так, видалити все",
"description_confirmation_delete_all_sources": "Ви видалите всі джерела завантаження",
"title_confirmation_delete_all_sources": "Видалити всі джерела завантаження",
"removed_download_sources": "Джерела завантажень видалено",
"button_delete_all_sources": "Видаліть усі джерела завантаження",
"api_token": "API-токен",
"debrid_api_token_hint": "API токен можливо отримати <0>тут</0>",
"real_debrid_api_token_label": "Real-Debrid API-токен",

View file

@ -226,6 +226,12 @@
"download_sources_description": "Hydra 将从这些源获取下载链接。源 URL 必须是直接链接到包含下载链接的 .json 文件。",
"validate_download_source": "验证",
"remove_download_source": "移除",
"cancel_button_confirmation_delete_all_sources": "不",
"confirm_button_confirmation_delete_all_sources": "是的,删除所有内容",
"description_confirmation_delete_all_sources": "您将删除所有下载源",
"title_confirmation_delete_all_sources": "删除所有下载源",
"removed_download_sources": "已删除字体",
"button_delete_all_sources": "删除所有下载源",
"add_download_source": "添加源",
"download_count_zero": "列表中无下载",
"download_count_one": "列表中有 {{countFormatted}} 个下载",

View file

@ -10,6 +10,8 @@ export interface ConfirmationModalProps extends Omit<ModalProps, "children"> {
onConfirm: () => void;
onCancel?: () => void;
buttonsIsDisabled?: boolean;
}
export function ConfirmationModal({
@ -18,6 +20,7 @@ export function ConfirmationModal({
descriptionText,
onConfirm,
onCancel,
buttonsIsDisabled = false,
...props
}: ConfirmationModalProps) {
const handleCancelClick = () => {
@ -38,7 +41,11 @@ export function ConfirmationModal({
<Button theme="outline" onClick={handleCancelClick}>
{cancelButtonLabel}
</Button>
<Button theme="danger" onClick={onConfirm}>
<Button
theme="danger"
disabled={buttonsIsDisabled}
onClick={onConfirm}
>
{confirmButtonLabel}
</Button>
</div>

View file

@ -53,4 +53,9 @@
text-decoration: none;
}
}
&__remove_all_sources_button {
display: flex;
justify-content: flex-end;
}
}

View file

@ -1,10 +1,20 @@
import { useContext, useEffect, useState } from "react";
import { TextField, Button, Badge } from "@renderer/components";
import {
TextField,
Button,
Badge,
ConfirmationModal,
} from "@renderer/components";
import { useTranslation } from "react-i18next";
import type { DownloadSource } from "@types";
import { NoEntryIcon, PlusCircleIcon, SyncIcon } from "@primer/octicons-react";
import {
NoEntryIcon,
PlusCircleIcon,
SyncIcon,
XIcon,
} from "@primer/octicons-react";
import { AddDownloadSourceModal } from "./add-download-source-modal";
import { useAppDispatch, useRepacks, useToast } from "@renderer/hooks";
import { DownloadSourceStatus } from "@shared";
@ -16,6 +26,10 @@ import { setFilters, clearFilters } from "@renderer/features";
import "./settings-download-sources.scss";
export function SettingsDownloadSources() {
const [
showConfirmationDeleteAllSourcesModal,
setShowConfirmationDeleteAllSourcesModal,
] = useState(false);
const [showAddDownloadSourceModal, setShowAddDownloadSourceModal] =
useState(false);
const [downloadSources, setDownloadSources] = useState<DownloadSource[]>([]);
@ -23,6 +37,7 @@ export function SettingsDownloadSources() {
useState(false);
const [isRemovingDownloadSource, setIsRemovingDownloadSource] =
useState(false);
const [isFetchingSources, setIsFetchingSources] = useState(true);
const { sourceUrl, clearSourceUrl } = useContext(settingsContext);
@ -41,6 +56,9 @@ export function SettingsDownloadSources() {
.sortBy("createdAt")
.then((sources) => {
setDownloadSources(sources.reverse());
})
.finally(() => {
setIsFetchingSources(false);
});
};
@ -68,6 +86,25 @@ export function SettingsDownloadSources() {
};
};
const handleRemoveAllDownloadSources = () => {
setIsRemovingDownloadSource(true);
const id = crypto.randomUUID();
const channel = new BroadcastChannel(`download_sources:delete_all:${id}`);
downloadSourcesWorker.postMessage(["DELETE_ALL_DOWNLOAD_SOURCES", id]);
channel.onmessage = () => {
showSuccessToast(t("removed_download_sources"));
getDownloadSources();
setIsRemovingDownloadSource(false);
setShowConfirmationDeleteAllSourcesModal(false);
channel.close();
updateRepacks();
};
};
const handleAddDownloadSource = async () => {
await getDownloadSources();
showSuccessToast(t("added_download_source"));
@ -115,6 +152,17 @@ export function SettingsDownloadSources() {
onClose={handleModalClose}
onAddDownloadSource={handleAddDownloadSource}
/>
<ConfirmationModal
cancelButtonLabel={t("cancel_button_confirmation_delete_all_sources")}
confirmButtonLabel={t("confirm_button_confirmation_delete_all_sources")}
descriptionText={t("description_confirmation_delete_all_sources")}
clickOutsideToClose={false}
onConfirm={handleRemoveAllDownloadSources}
visible={showConfirmationDeleteAllSourcesModal}
title={t("title_confirmation_delete_all_sources")}
onClose={() => setShowConfirmationDeleteAllSourcesModal(false)}
buttonsIsDisabled={isRemovingDownloadSource}
/>
<p>{t("download_sources_description")}</p>
@ -144,6 +192,20 @@ export function SettingsDownloadSources() {
</Button>
</div>
{!isFetchingSources && downloadSources.length >= 2 && (
<div className="settings-download-sources__remove_all_sources_button">
<Button
type="button"
theme="danger"
onClick={() => setShowConfirmationDeleteAllSourcesModal(true)}
disabled={isRemovingDownloadSource}
>
<XIcon />
{t("button_delete_all_sources")}
</Button>
</div>
)}
<ul className="settings-download-sources__list">
{downloadSources.map((downloadSource) => (
<li

View file

@ -23,7 +23,8 @@ type Payload =
| ["IMPORT_DOWNLOAD_SOURCE", string]
| ["DELETE_DOWNLOAD_SOURCE", number]
| ["VALIDATE_DOWNLOAD_SOURCE", string]
| ["SYNC_DOWNLOAD_SOURCES", string];
| ["SYNC_DOWNLOAD_SOURCES", string]
| ["DELETE_ALL_DOWNLOAD_SOURCES", string];
export type SteamGamesByLetter = Record<string, { id: string; name: string }[]>;
@ -114,6 +115,13 @@ const deleteDownloadSource = async (id: number) => {
});
};
const deleteAllDowloadSources = async () => {
await db.transaction("rw", repacksTable, downloadSourcesTable, async () => {
await repacksTable.clear();
await downloadSourcesTable.clear();
});
};
self.onmessage = async (event: MessageEvent<Payload>) => {
const [type, data] = event.data;
@ -132,6 +140,14 @@ self.onmessage = async (event: MessageEvent<Payload>) => {
});
}
if (type === "DELETE_ALL_DOWNLOAD_SOURCES") {
await deleteAllDowloadSources();
const channel = new BroadcastChannel(`download_sources:delete_all:${data}`);
channel.postMessage(true);
}
if (type === "DELETE_DOWNLOAD_SOURCE") {
await deleteDownloadSource(data);