Skip to content

Commit bb94269

Browse files
committed
feat(providers): implement delete all connected accounts functionality
Adds a "Delete All" button and confirmation dialog to the Providers page. Introduces `isDeletingAll`, `executeDeleteAll`, `showDeleteAllConfirmation`, and `setShowDeleteAllConfirmation` states and functions in `useProvidersPresenter`. Implements the `executeDeleteAll` logic to call the new `authFilesApi.deleteAll` endpoint. Adds the `deleteAll` method to `authFilesApi` to send a DELETE request to `/auth-files?all=true`. Includes new internationalization keys for "Delete All" related texts across all locales. Bumps the application version to `1.1.0` in `package.json`, `Cargo.toml`, and `tauri.conf.json`. This provides users with a convenient and efficient way to remove all their connected provider accounts simultaneously, improving account management. It also ensures a consistent and localized user experience for this new functionality and reflects the new feature set in the application's version.
1 parent ebe362a commit bb94269

13 files changed

Lines changed: 124 additions & 17 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zero-limit",
3-
"version": "1.0.9",
3+
"version": "1.1.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zero-limit"
3-
version = "1.0.9"
3+
version = "1.1.0"
44
description = "ZeroLimit AI Coding Assistant Quota Tracker"
55
authors = ["0xtbug"]
66
edition = "2021"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "ZeroLimit",
4-
"version": "1.0.9",
4+
"version": "1.1.0",
55
"identifier": "com.0xtbug.zero-limit",
66
"build": {
77
"beforeDevCommand": "pnpm dev",

src/features/providers/ProvidersPage.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export function ProvidersPage() {
6262
isPrivacyMode,
6363
togglePrivacyMode,
6464
openInBrowser,
65+
isDeletingAll,
66+
executeDeleteAll,
67+
showDeleteAllConfirmation,
68+
setShowDeleteAllConfirmation,
6569
} = useProvidersPresenter();
6670

6771
if (!isAuthenticated) {
@@ -99,6 +103,37 @@ export function ProvidersPage() {
99103
</AlertDialogContent>
100104
</AlertDialog>
101105

106+
<AlertDialog open={showDeleteAllConfirmation} onOpenChange={setShowDeleteAllConfirmation}>
107+
<AlertDialogContent className="border-border/50">
108+
<AlertDialogHeader>
109+
<AlertDialogTitle>{t('common.confirm', 'Are you sure?')}</AlertDialogTitle>
110+
<AlertDialogDescription>
111+
{t('providers.deleteAllConfirm', 'This will permanently delete all connected accounts. This action cannot be undone.')}
112+
</AlertDialogDescription>
113+
</AlertDialogHeader>
114+
<AlertDialogFooter>
115+
<AlertDialogCancel disabled={isDeletingAll}>{t('common.cancel')}</AlertDialogCancel>
116+
<AlertDialogAction
117+
onClick={(e) => {
118+
e.preventDefault();
119+
executeDeleteAll();
120+
}}
121+
className="bg-red-500 hover:bg-red-600 text-white"
122+
disabled={isDeletingAll}
123+
>
124+
{isDeletingAll ? (
125+
<>
126+
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
127+
{t('common.deleting', 'Deleting...')}
128+
</>
129+
) : (
130+
t('common.deleteAll', 'Delete All')
131+
)}
132+
</AlertDialogAction>
133+
</AlertDialogFooter>
134+
</AlertDialogContent>
135+
</AlertDialog>
136+
102137
<div className="flex items-center justify-between">
103138
<h1 className="text-3xl font-bold">{t('providers.title')}</h1>
104139

@@ -119,6 +154,17 @@ export function ProvidersPage() {
119154
<CheckCircle className="h-5 w-5" />
120155
{t('providers.connectedAccounts')} ({files.length})
121156
</h2>
157+
{files.length > 0 && (
158+
<Button
159+
variant="outline"
160+
size="sm"
161+
onClick={() => setShowDeleteAllConfirmation(true)}
162+
className="h-8 text-xs bg-red-500/10 text-red-500 hover:bg-red-500/20 shadow-none border border-red-500/20"
163+
>
164+
<Trash2 className="mr-2 h-3.5 w-3.5" />
165+
{t('common.deleteAll', 'Delete All')}
166+
</Button>
167+
)}
122168
</div>
123169

124170
{filesError && (

src/features/providers/useProvidersPresenter.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export function useProvidersPresenter() {
5959
const [loadingFiles, setLoadingFiles] = useState(false);
6060
const [filesError, setFilesError] = useState<string | null>(null);
6161

62+
const [isDeletingAll, setIsDeletingAll] = useState(false);
63+
const [showDeleteAllConfirmation, setShowDeleteAllConfirmation] = useState(false);
64+
6265
const [providerStates, setProviderStates] = useState<Record<string, ProviderState>>({});
6366
const [callbackUrl, setCallbackUrl] = useState('');
6467
const [selectedProvider, setSelectedProvider] = useState<ProviderId | null>(null);
@@ -138,6 +141,21 @@ export function useProvidersPresenter() {
138141
}
139142
}, [fileToDelete, loadFiles]);
140143

144+
const executeDeleteAll = useCallback(async () => {
145+
setIsDeletingAll(true);
146+
try {
147+
await authFilesApi.deleteAll();
148+
setShowDeleteAllConfirmation(false);
149+
await loadFiles();
150+
toast.success(t('providers.deleteAllSuccess') || 'All accounts deleted successfully');
151+
} catch (err) {
152+
setFilesError((err as Error).message);
153+
toast.error((err as Error).message);
154+
} finally {
155+
setIsDeletingAll(false);
156+
}
157+
}, [loadFiles, t]);
158+
141159
const updateProviderState = useCallback((provider: string, update: Partial<ProviderState>) => {
142160
setProviderStates((prev) => ({
143161
...prev,
@@ -349,6 +367,12 @@ export function useProvidersPresenter() {
349367
setFileToDelete,
350368
executeDelete,
351369

370+
// Delete All
371+
isDeletingAll,
372+
executeDeleteAll,
373+
showDeleteAllConfirmation,
374+
setShowDeleteAllConfirmation,
375+
352376
// Add provider (OAuth)
353377
providerStates,
354378
selectedProvider,

src/i18n/locales/en.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"copy": "Copy",
1515
"copied": "Copied!",
1616
"download": "Download",
17-
"upload": "Upload"
17+
"upload": "Upload",
18+
"deleteAll": "Delete All",
19+
"deleting": "Deleting...",
20+
"deleteWarning": "This action cannot be undone. This will permanently delete your account connection."
1821
},
1922
"auth": {
2023
"login": "Login",
@@ -67,7 +70,9 @@
6770
"openLink": "Open Link",
6871
"verify": "Verify",
6972
"manualCallback": "If valid callback is not detected automatically:",
70-
"authSuccess": "Provider connected successfully!"
73+
"authSuccess": "Provider connected successfully!",
74+
"deleteAllConfirm": "This will permanently delete all connected accounts. This action cannot be undone.",
75+
"deleteAllSuccess": "All accounts deleted successfully"
7176
},
7277
"oauth": {
7378
"pasteCallback": "Paste callback URL here..."

src/i18n/locales/id.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"copy": "Salin",
1515
"copied": "Disalin!",
1616
"download": "Unduh",
17-
"upload": "Unggah"
17+
"upload": "Unggah",
18+
"deleteAll": "Hapus Semua",
19+
"deleting": "Menghapus...",
20+
"deleteWarning": "Tindakan ini tidak dapat dibatalkan. Ini akan menghapus koneksi akun Anda secara permanen."
1821
},
1922
"auth": {
2023
"login": "Masuk",
@@ -67,7 +70,9 @@
6770
"openLink": "Buka Tautan",
6871
"verify": "Verifikasi",
6972
"manualCallback": "Jika callback valid tidak terdeteksi otomatis:",
70-
"authSuccess": "Penyedia berhasil terhubung!"
73+
"authSuccess": "Penyedia berhasil terhubung!",
74+
"deleteAllConfirm": "Ini akan menghapus semua akun yang terhubung secara permanen. Tindakan ini tidak dapat dibatalkan.",
75+
"deleteAllSuccess": "Semua akun berhasil dihapus"
7176
},
7277
"oauth": {
7378
"pasteCallback": "Tempelkan URL callback di sini..."

src/i18n/locales/ja.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"copy": "コピー",
1515
"copied": "コピーしました!",
1616
"download": "ダウンロード",
17-
"upload": "アップロード"
17+
"upload": "アップロード",
18+
"deleteAll": "すべて削除",
19+
"deleting": "削除中...",
20+
"deleteWarning": "この操作は取り消せません。アカウント接続が完全に削除されます。"
1821
},
1922
"auth": {
2023
"login": "ログイン",
@@ -67,7 +70,9 @@
6770
"openLink": "リンクを開く",
6871
"verify": "確認",
6972
"manualCallback": "有効なコールバックが自動検出されない場合:",
70-
"authSuccess": "プロバイダーの接続に成功しました!"
73+
"authSuccess": "プロバイダーの接続に成功しました!",
74+
"deleteAllConfirm": "接続されているすべてのアカウントが完全に削除されます。この操作は取り消せません。",
75+
"deleteAllSuccess": "すべてのアカウントが正常に削除されました"
7176
},
7277
"oauth": {
7378
"pasteCallback": "コールバックURLをここに貼り付け..."

src/i18n/locales/ko.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"copy": "복사",
1515
"copied": "복사되었습니다!",
1616
"download": "다운로드",
17-
"upload": "업로드"
17+
"upload": "업로드",
18+
"deleteAll": "모두 삭제",
19+
"deleting": "삭제 중...",
20+
"deleteWarning": "이 작업은 취소할 수 없습니다. 계정 연결이 영구적으로 삭제됩니다."
1821
},
1922
"auth": {
2023
"login": "로그인",
@@ -67,7 +70,9 @@
6770
"openLink": "링크 열기",
6871
"verify": "확인",
6972
"manualCallback": "유효한 콜백이 자동으로 감지되지 않는 경우:",
70-
"authSuccess": "제공자가 성공적으로 연결되었습니다!"
73+
"authSuccess": "제공자가 성공적으로 연결되었습니다!",
74+
"deleteAllConfirm": "연결된 모든 계정이 영구적으로 삭제됩니다. 이 작업은 취소할 수 없습니다.",
75+
"deleteAllSuccess": "모든 계정이 성공적으로 삭제되었습니다"
7176
},
7277
"oauth": {
7378
"pasteCallback": "콜백 URL을 여기에 붙여넣기..."

src/i18n/locales/th.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
"copy": "คัดลอก",
1515
"copied": "คัดลอกแล้ว!",
1616
"download": "ดาวน์โหลด",
17-
"upload": "อัปโหลด"
17+
"upload": "อัปโหลด",
18+
"deleteAll": "ลบทั้งหมด",
19+
"deleting": "กำลังลบ...",
20+
"deleteWarning": "การดำเนินการนี้ไม่สามารถยกเลิกได้ การเชื่อมต่อบัญชีของคุณจะถูกลบอย่างถาวร"
1821
},
1922
"auth": {
2023
"login": "เข้าสู่ระบบ",
@@ -67,7 +70,9 @@
6770
"openLink": "เปิดลิงก์",
6871
"verify": "ตรวจสอบ",
6972
"manualCallback": "หากระบบไม่ตรวจพบ callback ที่ถูกต้องโดยอัตโนมัติ:",
70-
"authSuccess": "เชื่อมต่อผู้ให้บริการสำเร็จ!"
73+
"authSuccess": "เชื่อมต่อผู้ให้บริการสำเร็จ!",
74+
"deleteAllConfirm": "บัญชีที่เชื่อมต่อทั้งหมดจะถูกลบอย่างถาวร การดำเนินการนี้ไม่สามารถยกเลิกได้",
75+
"deleteAllSuccess": "ลบบัญชีทั้งหมดเรียบร้อยแล้ว"
7176
},
7277
"oauth": {
7378
"pasteCallback": "วาง URL callback ที่นี่..."

0 commit comments

Comments
 (0)