fix(core): settings storage empty styles (#10313)

This commit is contained in:
Peng Xiao
2025-02-21 17:19:53 +08:00
committed by GitHub
parent 24fa58df52
commit 83669f8fbb
4 changed files with 61 additions and 40 deletions

View File

@@ -214,8 +214,8 @@ export const BackupSettingPanel = () => {
/> />
); );
} }
if (backupWorkspaces?.items.length === 0 || !backupWorkspaces) { if (!backupWorkspaces) {
return <Empty />; return null;
} }
return ( return (
<> <>
@@ -242,6 +242,9 @@ export const BackupSettingPanel = () => {
); );
}, [isLoading, backupWorkspaces, pageNum]); }, [isLoading, backupWorkspaces, pageNum]);
const isEmpty =
(backupWorkspaces?.items.length === 0 || !backupWorkspaces) && !isLoading;
return ( return (
<> <>
<SettingHeader <SettingHeader
@@ -249,7 +252,11 @@ export const BackupSettingPanel = () => {
subtitle={t['com.affine.settings.workspace.backup.subtitle']()} subtitle={t['com.affine.settings.workspace.backup.subtitle']()}
data-testid="backup-title" data-testid="backup-title"
/> />
{isEmpty ? (
<Empty />
) : (
<div className={styles.listContainer}>{innerElement}</div> <div className={styles.listContainer}>{innerElement}</div>
)}
</> </>
); );
}; };

View File

@@ -62,7 +62,12 @@ export const listItemRightLabel = style({
}); });
export const empty = style({ export const empty = style({
padding: '8px 16px', paddingTop: '64px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: cssVarV2('text/secondary'),
fontSize: cssVar('fontSm'),
}); });
export const pagination = style({ export const pagination = style({

View File

@@ -261,6 +261,8 @@ export const BlobManagementPanel = () => {
return; return;
}, [unusedBlobs]); }, [unusedBlobs]);
const isEmpty = (unusedBlobs.length === 0 || !unusedBlobs) && !isLoading;
return ( return (
<> <>
{selectedBlobs.length > 0 ? ( {selectedBlobs.length > 0 ? (
@@ -288,13 +290,14 @@ export const BlobManagementPanel = () => {
{`${t['com.affine.settings.workspace.storage.unused-blobs']()} (${unusedBlobs.length})`} {`${t['com.affine.settings.workspace.storage.unused-blobs']()} (${unusedBlobs.length})`}
</div> </div>
)} )}
{isEmpty ? (
<Empty />
) : (
<div className={styles.blobManagementContainer}> <div className={styles.blobManagementContainer}>
{isLoading ? ( {isLoading ? (
<div className={styles.loadingContainer}> <div className={styles.loadingContainer}>
<Loading size={32} /> <Loading size={32} />
</div> </div>
) : unusedBlobs.length === 0 ? (
<Empty />
) : ( ) : (
<> <>
<div className={styles.blobPreviewGrid} ref={blobPreviewGridRef}> <div className={styles.blobPreviewGrid} ref={blobPreviewGridRef}>
@@ -324,6 +327,7 @@ export const BlobManagementPanel = () => {
</> </>
)} )}
</div> </div>
)}
</> </>
); );
}; };

View File

@@ -88,7 +88,12 @@ export const loadingContainer = style({
}); });
export const empty = style({ export const empty = style({
padding: '8px 16px', paddingTop: '64px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: cssVarV2('text/secondary'),
fontSize: cssVar('fontSm'),
}); });
export const blobPreviewContainer = style({ export const blobPreviewContainer = style({