refactor(ui): remove model catalog and refine version management layout
This commit is contained in:
1 parent
662685c81e
commit
27520fc349
2 files changed
+8
-85
No files matched your search
@@ -5,7 +5,6 @@ import { listen } from '@tauri-apps/api/event';
|
||||
import {
|
||||
AlertCircle,
|
||||
Check,
|
||||
Database,
|
||||
Download,
|
||||
ExternalLink,
|
||||
Info,
|
||||
@@ -39,10 +38,6 @@ export type CoreInstallTask = {
|
||||
result: CoreInstallResult | null;
|
||||
};
|
||||
|
||||
export type CodexModelCatalogUpdateResult = {
|
||||
outcome: 'updated' | 'unchanged';
|
||||
};
|
||||
|
||||
export type VersionSourceSettings = {
|
||||
preferGitcodeDownloads: boolean;
|
||||
gitcodeAvailable: boolean;
|
||||
@@ -124,10 +119,6 @@ export function VersionManagementPage() {
|
||||
const [versionSourceSaving, setVersionSourceSaving] = useState(false);
|
||||
const [versionSourceError, setVersionSourceError] = useState('');
|
||||
|
||||
const [catalogUpdating, setCatalogUpdating] = useState(false);
|
||||
const [catalogUpdateError, setCatalogUpdateError] = useState('');
|
||||
const [catalogUpdateNotice, setCatalogUpdateNotice] = useState('');
|
||||
|
||||
const [toastNotice, setToastNotice] = useState<{
|
||||
message: string;
|
||||
tone: MessageType;
|
||||
@@ -316,26 +307,6 @@ export function VersionManagementPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const syncModelCatalog = async () => {
|
||||
setCatalogUpdating(true);
|
||||
setCatalogUpdateError('');
|
||||
setCatalogUpdateNotice('');
|
||||
try {
|
||||
const result = await invoke<CodexModelCatalogUpdateResult>('update_codex_model_catalog');
|
||||
const notice = result.outcome === 'updated'
|
||||
? t('appUpdate.catalog.updated')
|
||||
: t('appUpdate.catalog.unchanged');
|
||||
setCatalogUpdateNotice(notice);
|
||||
showToast(notice, 'success');
|
||||
} catch (error) {
|
||||
const err = String(error);
|
||||
setCatalogUpdateError(err);
|
||||
showToast(err, 'error');
|
||||
} finally {
|
||||
setCatalogUpdating(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
let disposed = false;
|
||||
let unlisten: (() => void) | null = null;
|
||||
@@ -677,51 +648,6 @@ export function VersionManagementPage() {
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article className="version-list-item catalog-module-card">
|
||||
<div className="version-item-content">
|
||||
<div className="version-card-top">
|
||||
<h2>{t('kernel.versions.catalogCardTitle')}</h2>
|
||||
{catalogUpdating || catalogUpdateError ? (
|
||||
<span className={`version-row-status ${catalogUpdateError ? 'error' : 'info'}`}>
|
||||
{catalogUpdating ? t('appUpdate.catalog.updating') : t('kernel.update.failed')}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<p className="version-catalog-description">
|
||||
{t('appUpdate.catalog.description')}
|
||||
</p>
|
||||
|
||||
{catalogUpdateError ? (
|
||||
<div className="version-alert-banner error" role="alert">
|
||||
<AlertCircle size={14} />
|
||||
<span>{catalogUpdateError}</span>
|
||||
</div>
|
||||
) : catalogUpdateNotice ? (
|
||||
<div className="version-alert-banner success">
|
||||
<Check size={14} />
|
||||
<span>{catalogUpdateNotice}</span>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="version-card-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="secondary-button"
|
||||
disabled={catalogUpdating || appUpdateTask.running || busy}
|
||||
onClick={() => void syncModelCatalog()}
|
||||
title={t('appUpdate.catalog.updateHint')}
|
||||
>
|
||||
<Database size={15} className={catalogUpdating ? 'spin' : ''} aria-hidden="true" />
|
||||
<span>
|
||||
{catalogUpdating
|
||||
? t('appUpdate.catalog.updating')
|
||||
: t('appUpdate.catalog.update')}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
+8
-11
@@ -1075,7 +1075,7 @@ textarea:focus-visible {
|
||||
|
||||
.version-card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
align-items: stretch;
|
||||
gap: 14px;
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ textarea:focus-visible {
|
||||
.version-list-item {
|
||||
display: grid;
|
||||
grid-template-rows: minmax(0, 1fr) auto;
|
||||
min-height: 210px;
|
||||
min-height: 220px;
|
||||
align-items: stretch;
|
||||
gap: 18px;
|
||||
padding: 20px;
|
||||
@@ -1154,6 +1154,7 @@ textarea:focus-visible {
|
||||
min-width: 0;
|
||||
gap: 2px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--theme-e8e5dc);
|
||||
border-radius: 8px;
|
||||
background: var(--theme-faf9f5);
|
||||
}
|
||||
@@ -1234,7 +1235,7 @@ textarea:focus-visible {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
flex: 1 1 calc(50% - 4px);
|
||||
flex: 1 1 112px;
|
||||
min-height: 33px;
|
||||
padding: 5px 10px;
|
||||
font-weight: 600;
|
||||
@@ -1242,14 +1243,6 @@ textarea:focus-visible {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.version-catalog-description {
|
||||
margin: 5px 0 0;
|
||||
color: var(--theme-7a746c);
|
||||
font-size: var(--font-size-meta);
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
|
||||
.client-api-panel {
|
||||
margin-top: 0;
|
||||
}
|
||||
@@ -1624,6 +1617,10 @@ textarea:focus-visible {
|
||||
}
|
||||
|
||||
@container workspace (max-width: 760px) {
|
||||
.version-card-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.version-list-item {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user