Skip to content

Commit 83669f8

Browse files
authored
fix(core): settings storage empty styles (#10313)
1 parent 24fa58d commit 83669f8

File tree

4 files changed

+61
-40
lines changed

4 files changed

+61
-40
lines changed

packages/frontend/core/src/desktop/dialogs/setting/general-setting/backup/index.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ export const BackupSettingPanel = () => {
214214
/>
215215
);
216216
}
217-
if (backupWorkspaces?.items.length === 0 || !backupWorkspaces) {
218-
return <Empty />;
217+
if (!backupWorkspaces) {
218+
return null;
219219
}
220220
return (
221221
<>
@@ -242,14 +242,21 @@ export const BackupSettingPanel = () => {
242242
);
243243
}, [isLoading, backupWorkspaces, pageNum]);
244244

245+
const isEmpty =
246+
(backupWorkspaces?.items.length === 0 || !backupWorkspaces) && !isLoading;
247+
245248
return (
246249
<>
247250
<SettingHeader
248251
title={t['com.affine.settings.workspace.backup']()}
249252
subtitle={t['com.affine.settings.workspace.backup.subtitle']()}
250253
data-testid="backup-title"
251254
/>
252-
<div className={styles.listContainer}>{innerElement}</div>
255+
{isEmpty ? (
256+
<Empty />
257+
) : (
258+
<div className={styles.listContainer}>{innerElement}</div>
259+
)}
253260
</>
254261
);
255262
};

packages/frontend/core/src/desktop/dialogs/setting/general-setting/backup/styles.css.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ export const listItemRightLabel = style({
6262
});
6363

6464
export const empty = style({
65-
padding: '8px 16px',
65+
paddingTop: '64px',
66+
display: 'flex',
67+
alignItems: 'center',
68+
justifyContent: 'center',
69+
color: cssVarV2('text/secondary'),
70+
fontSize: cssVar('fontSm'),
6671
});
6772

6873
export const pagination = style({

packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/blob-management.tsx

+39-35
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ export const BlobManagementPanel = () => {
261261
return;
262262
}, [unusedBlobs]);
263263

264+
const isEmpty = (unusedBlobs.length === 0 || !unusedBlobs) && !isLoading;
265+
264266
return (
265267
<>
266268
{selectedBlobs.length > 0 ? (
@@ -288,42 +290,44 @@ export const BlobManagementPanel = () => {
288290
{`${t['com.affine.settings.workspace.storage.unused-blobs']()} (${unusedBlobs.length})`}
289291
</div>
290292
)}
291-
<div className={styles.blobManagementContainer}>
292-
{isLoading ? (
293-
<div className={styles.loadingContainer}>
294-
<Loading size={32} />
295-
</div>
296-
) : unusedBlobs.length === 0 ? (
297-
<Empty />
298-
) : (
299-
<>
300-
<div className={styles.blobPreviewGrid} ref={blobPreviewGridRef}>
301-
{unusedBlobsPage.map(blob => {
302-
const selected = selectedBlobs.includes(blob);
303-
return (
304-
<BlobCard
305-
key={blob.key}
306-
blobRecord={blob}
307-
onClick={e => handleBlobClick(blob, e)}
308-
selected={selected}
309-
/>
310-
);
311-
})}
293+
{isEmpty ? (
294+
<Empty />
295+
) : (
296+
<div className={styles.blobManagementContainer}>
297+
{isLoading ? (
298+
<div className={styles.loadingContainer}>
299+
<Loading size={32} />
312300
</div>
313-
{unusedBlobs.length > PAGE_SIZE && (
314-
<Pagination
315-
pageNum={pageNum}
316-
totalCount={unusedBlobs.length}
317-
countPerPage={PAGE_SIZE}
318-
onPageChange={(_, pageNum) => {
319-
setPageNum(pageNum);
320-
setSkip(pageNum * PAGE_SIZE);
321-
}}
322-
/>
323-
)}
324-
</>
325-
)}
326-
</div>
301+
) : (
302+
<>
303+
<div className={styles.blobPreviewGrid} ref={blobPreviewGridRef}>
304+
{unusedBlobsPage.map(blob => {
305+
const selected = selectedBlobs.includes(blob);
306+
return (
307+
<BlobCard
308+
key={blob.key}
309+
blobRecord={blob}
310+
onClick={e => handleBlobClick(blob, e)}
311+
selected={selected}
312+
/>
313+
);
314+
})}
315+
</div>
316+
{unusedBlobs.length > PAGE_SIZE && (
317+
<Pagination
318+
pageNum={pageNum}
319+
totalCount={unusedBlobs.length}
320+
countPerPage={PAGE_SIZE}
321+
onPageChange={(_, pageNum) => {
322+
setPageNum(pageNum);
323+
setSkip(pageNum * PAGE_SIZE);
324+
}}
325+
/>
326+
)}
327+
</>
328+
)}
329+
</div>
330+
)}
327331
</>
328332
);
329333
};

packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/style.css.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ export const loadingContainer = style({
8888
});
8989

9090
export const empty = style({
91-
padding: '8px 16px',
91+
paddingTop: '64px',
92+
display: 'flex',
93+
alignItems: 'center',
94+
justifyContent: 'center',
95+
color: cssVarV2('text/secondary'),
96+
fontSize: cssVar('fontSm'),
9297
});
9398

9499
export const blobPreviewContainer = style({

0 commit comments

Comments
 (0)