feat(web): add reusable admin form dialog

This commit is contained in:
2026-05-09 20:15:35 +08:00
parent c0335bd5d0
commit a5e66e79cd
49 changed files with 6013 additions and 1108 deletions
+230
View File
@@ -0,0 +1,230 @@
.landingPage {
display: grid;
gap: 24px;
}
.releaseNotice {
display: flex;
min-height: 48px;
align-items: center;
gap: 12px;
padding: 10px 16px;
border: 1px solid #d7eadf;
border-radius: 10px;
background: #f1fbf5;
color: #155e3d;
}
.releaseNotice strong {
white-space: nowrap;
}
.releaseNotice span {
color: #43735b;
font-size: 13px;
}
.landingHero {
display: grid;
min-height: 470px;
grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
gap: 32px;
align-items: center;
padding: 44px;
border: 1px solid var(--border);
border-radius: 12px;
background:
linear-gradient(120deg, rgba(245, 250, 255, 0.96), rgba(255, 255, 255, 0.9)),
#ffffff;
}
.landingCopy {
display: grid;
gap: 18px;
}
.landingCopy h1 {
max-width: 720px;
font-size: 48px;
line-height: 1.08;
}
.landingCopy p {
max-width: 660px;
color: #475467;
font-size: 16px;
line-height: 1.75;
}
.landingActions {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.gatewayPreview {
display: grid;
gap: 16px;
padding: 18px;
border: 1px solid #dbe5ef;
border-radius: 10px;
background: #f8fafc;
box-shadow: 0 18px 45px rgba(16, 24, 40, 0.10);
}
.previewHeader,
.previewFlow {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.previewHeader {
padding-bottom: 12px;
border-bottom: 1px solid var(--border);
font-weight: 900;
}
.previewGrid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.previewGrid div {
display: grid;
gap: 8px;
min-height: 92px;
padding: 14px;
border: 1px solid var(--border);
border-radius: 8px;
background: #fff;
}
.previewGrid span {
color: var(--muted-foreground);
font-size: 12px;
font-weight: 800;
}
.previewGrid strong {
font-size: 15px;
}
.previewFlow {
padding: 14px;
border-radius: 8px;
background: #102033;
color: #fff;
font-size: 12px;
font-weight: 800;
}
.previewFlow span {
min-width: 0;
}
.landingSection {
display: grid;
gap: 14px;
}
.landingSectionHeader {
display: grid;
gap: 6px;
}
.landingSectionHeader h2 {
font-size: 22px;
}
.coverageGrid,
.advantageGrid {
display: grid;
gap: 14px;
}
.coverageGrid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.advantageGrid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.landingFeatureCard,
.advantageCard {
display: grid;
gap: 14px;
min-height: 190px;
}
.landingFeatureCard span,
.advantageCard p {
color: var(--muted-foreground);
font-size: 13px;
line-height: 1.6;
}
.landingFeatureCard strong {
display: block;
margin: 8px 0;
font-size: 18px;
}
.advantageCard strong {
font-size: 17px;
}
.loginRequiredPage {
display: grid;
grid-template-columns: minmax(0, 0.75fr) minmax(420px, 1fr);
gap: 28px;
align-items: center;
min-height: calc(100vh - 160px);
}
.loginRequiredCopy {
display: grid;
gap: 12px;
}
.loginRequiredCopy p:not(.eyebrow) {
color: var(--muted-foreground);
line-height: 1.7;
}
.loginRequiredPage .authShell {
min-height: auto;
}
@media (max-width: 980px) {
.landingHero,
.loginRequiredPage {
grid-template-columns: 1fr;
}
.landingHero {
padding: 24px;
}
.landingCopy h1 {
font-size: 34px;
}
.coverageGrid,
.advantageGrid,
.previewGrid {
grid-template-columns: 1fr;
}
.releaseNotice {
align-items: flex-start;
flex-direction: column;
}
.releaseNotice strong {
white-space: normal;
}
}
+776
View File
@@ -0,0 +1,776 @@
.subPageLayout {
display: grid;
grid-template-columns: 220px minmax(0, 1fr);
gap: 18px;
align-items: start;
}
.subPageContent {
min-width: 0;
}
.sideTabs {
position: sticky;
top: 88px;
display: grid;
gap: 6px;
padding: 8px;
background: #fff;
}
.sideTabs .shTab {
justify-content: flex-start;
}
.modelsPage {
display: grid;
grid-template-columns: 246px minmax(0, 1fr);
gap: 22px;
align-items: start;
}
.modelFilters {
position: sticky;
top: 88px;
display: grid;
gap: 22px;
padding-right: 18px;
border-right: 1px solid var(--border);
}
.filterGroup {
display: grid;
gap: 12px;
}
.filterGroup h3 {
color: #1f2937;
font-size: 14px;
}
.filterChips {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.filterChip {
min-height: 28px;
padding: 0 10px;
border: 1px solid var(--border);
border-radius: 6px;
background: #fff;
color: #344054;
font-size: 12px;
font-weight: 800;
}
.filterChip[data-active="true"] {
border-color: #2f6fe4;
background: #2f6fe4;
color: #fff;
}
.modelsContent {
display: grid;
min-width: 0;
gap: 14px;
}
.modelSearchBar {
display: flex;
justify-content: flex-end;
}
.searchField {
display: grid;
width: min(420px, 100%);
grid-template-columns: 34px minmax(0, 1fr);
align-items: center;
border: 1px solid var(--border);
border-radius: 999px;
background: #fff;
color: var(--muted-foreground);
}
.searchField svg {
margin-left: 12px;
}
.searchField .shInput {
border: 0;
border-radius: 999px;
box-shadow: none;
}
.providerHero {
display: flex;
min-height: 86px;
align-items: center;
gap: 14px;
padding: 18px;
border: 1px solid #ebe5fb;
border-radius: 8px;
background: #f6f1ff;
}
.providerHero strong {
display: block;
font-size: 18px;
}
.providerHero span {
color: var(--muted-foreground);
font-size: 13px;
}
.providerLogo,
.modelIcon {
display: grid;
width: 42px;
height: 42px;
place-items: center;
border-radius: 8px;
background: #fff;
color: #111827;
font-weight: 900;
}
.modelIconImage {
overflow: hidden;
padding: 7px;
}
.modelIconImage img {
width: 100%;
height: 100%;
object-fit: contain;
}
.providerHero .shBadge {
margin-left: auto;
}
.modelCards {
display: grid;
grid-template-columns: repeat(3, minmax(260px, 1fr));
gap: 14px;
}
.modelCard .shCardContent {
display: grid;
min-height: 150px;
gap: 13px;
}
.modelCardTop {
display: grid;
grid-template-columns: 42px minmax(0, 1fr) auto;
gap: 11px;
align-items: start;
}
.modelCardTop strong,
.modelCardTop span,
.modelCard p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.modelCardTop span,
.modelCard p,
.modelCardFooter span {
color: var(--muted-foreground);
font-size: 12px;
}
.modelTags {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.modelTags span {
padding: 4px 7px;
border-radius: 5px;
background: #fff5e7;
color: #9a5b12;
font-size: 12px;
}
.modelCardFooter {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: auto;
}
.modelCardFooter a {
color: #2563eb;
font-size: 12px;
font-weight: 800;
text-decoration: none;
}
.providerToolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
}
.providerToolbar p {
margin: 0;
color: var(--muted-foreground);
font-size: 13px;
}
.formMessage {
margin-top: 12px;
color: var(--muted-foreground);
font-size: 13px;
font-weight: 700;
}
.providerCatalogGrid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.providerCatalogCard {
display: grid;
grid-template-columns: 54px minmax(0, 1fr) auto;
gap: 14px;
align-items: center;
padding: 16px;
border: 1px solid var(--border);
border-radius: 8px;
background: #fff;
}
.providerCatalogLogo {
display: grid;
width: 54px;
height: 54px;
place-items: center;
overflow: hidden;
border: 1px solid #edf1f5;
border-radius: 8px;
background: #f8fafc;
color: #111827;
font-weight: 900;
}
.providerCatalogLogo img {
width: 100%;
height: 100%;
padding: 8px;
object-fit: contain;
}
.providerCatalogBody {
display: grid;
min-width: 0;
gap: 9px;
}
.providerCatalogBody strong,
.providerCatalogBody span {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.providerCatalogBody span,
.providerCatalogMeta {
color: var(--muted-foreground);
font-size: 12px;
}
.providerCatalogMeta,
.providerCatalogActions {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.providerCatalogActions {
justify-content: flex-end;
}
.modelCatalogFilters {
display: grid;
grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) minmax(160px, 220px);
gap: 10px;
margin-top: 14px;
}
.baseModelGrid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 14px;
}
.baseModelCard {
display: grid;
grid-template-columns: 54px minmax(0, 1fr);
gap: 14px;
min-height: 184px;
padding: 16px;
border: 1px solid var(--border);
border-radius: 8px;
background: #fff;
}
.baseModelCardBody {
display: grid;
min-width: 0;
gap: 10px;
}
.baseModelCardBody strong,
.baseModelCardBody span {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.baseModelCardBody > div:first-child span {
margin-top: 4px;
color: var(--muted-foreground);
font-size: 12px;
}
.baseModelCard .providerCatalogActions {
grid-column: 1 / -1;
}
.modelAbilityChips {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.modelAbilityChips span {
padding: 4px 7px;
border-radius: 5px;
background: #eef7ff;
color: #0f5d8f;
font-size: 12px;
font-weight: 800;
}
.baseModelDialog {
width: min(900px, 100%);
}
.baseModelForm textarea {
min-height: 124px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 12px;
}
.pricingRuleGrid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.pricingRuleCard {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid var(--border);
border-radius: 8px;
background: #fff;
}
.pricingRuleCard header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.pricingRuleCard strong,
.pricingRuleCard span {
display: block;
}
.pricingRuleCard header span,
.pricingRuleCard p {
margin: 0;
color: var(--muted-foreground);
font-size: 12px;
}
.pricingRuleItems {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.pricingRuleItems span {
padding: 5px 7px;
border-radius: 5px;
background: #f1f5f9;
color: #334155;
font-size: 12px;
font-weight: 800;
}
.pricingRuleDialog {
width: min(1120px, 100%);
}
.pricingRuleFormBody {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.pricingRuleEditor {
display: grid;
gap: 12px;
}
.pricingRuleEditorHeader,
.pricingRuleEditorCard header,
.pricingRuleSubHeader {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.pricingRuleEditorHeader strong,
.pricingRuleEditorCard strong,
.pricingRuleSubHeader strong {
display: block;
font-size: 14px;
}
.pricingRuleEditorHeader span,
.pricingRuleEditorCard header span,
.pricingRuleSubHeader span,
.pricingRuleEmpty span,
.mutedLine {
color: var(--muted-foreground);
font-size: 12px;
}
.pricingRuleQuickActions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.pricingRuleEditorCard,
.pricingRuleSubPanel,
.pricingRuleEmpty {
display: grid;
gap: 12px;
padding: 12px;
border: 1px solid var(--border);
border-radius: 8px;
background: #fbfcfe;
}
.pricingRuleEditorCard {
background: #fff;
}
.pricingRuleEditorCard header > div {
display: flex;
min-width: 0;
align-items: center;
gap: 8px;
}
.pricingRuleEditorCard header span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.pricingRuleFields {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
}
.dimensionChips {
display: flex;
flex-wrap: wrap;
gap: 7px;
}
.dimensionChips button {
min-height: 30px;
padding: 0 9px;
border: 1px solid var(--border);
border-radius: 999px;
background: #fff;
color: #475467;
font-size: 12px;
font-weight: 800;
}
.dimensionChips button.active {
border-color: #145388;
background: #eaf3fb;
color: #145388;
}
.weightGroup {
display: grid;
gap: 10px;
padding: 10px;
border: 1px dashed var(--border);
border-radius: 8px;
background: #fff;
}
.keyValueRows {
display: grid;
gap: 8px;
}
.keyValueRow {
display: grid;
grid-template-columns: minmax(120px, 0.55fr) minmax(140px, 1fr) 34px;
gap: 8px;
align-items: center;
}
.apiDocsShell {
display: grid;
min-height: calc(100vh - 120px);
grid-template-columns: 280px minmax(420px, 1fr) 360px;
gap: 0;
overflow: hidden;
border: 1px solid var(--border);
border-radius: 10px;
background: #fff;
}
.docsSidebar,
.docsArticle,
.docsRunner {
min-height: 0;
overflow: auto;
}
.docsSidebar {
padding: 18px;
border-right: 1px solid var(--border);
}
.docsBrand,
.docsSearch {
display: flex;
align-items: center;
gap: 10px;
}
.docsBrand {
margin-bottom: 18px;
font-size: 17px;
}
.docsSearch {
min-height: 40px;
padding: 0 12px;
border: 1px solid var(--border);
border-radius: 8px;
color: var(--muted-foreground);
}
.docsSearch input {
width: 100%;
border: 0;
outline: 0;
}
.docsGroup {
display: grid;
gap: 6px;
margin-top: 22px;
}
.docsGroup h3 {
margin-bottom: 4px;
color: var(--muted-foreground);
font-size: 13px;
}
.docsGroup button {
display: flex;
min-height: 34px;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 0 10px;
border: 0;
border-radius: 7px;
background: transparent;
color: #344054;
text-align: left;
}
.docsGroup button[data-active="true"] {
background: #f0e9ff;
color: #7048e8;
}
.docsArticle {
padding: 28px 34px 60px;
background: linear-gradient(90deg, #fff 0%, #fbf8ff 100%);
}
.docsArticle h1 {
margin-bottom: 20px;
}
.endpointBar,
.runnerEndpoint {
display: flex;
align-items: center;
gap: 10px;
padding: 10px;
border: 1px solid var(--border);
border-radius: 8px;
background: #fff;
}
.docsLead {
margin: 18px 0 24px;
color: #475467;
line-height: 1.7;
}
.paramCard {
margin-top: 18px;
overflow: hidden;
border: 1px solid var(--border);
border-radius: 10px;
background: #fff;
}
.paramCard header,
.docsRunner header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 14px 16px;
border-bottom: 1px solid var(--border);
}
.paramRow {
display: grid;
grid-template-columns: 150px 110px minmax(0, 1fr) 50px;
gap: 12px;
padding: 13px 16px;
border-bottom: 1px solid #f0f2f5;
color: #475467;
font-size: 13px;
}
.paramRow em {
color: #f97316;
font-style: normal;
}
.docsRunner {
border-left: 1px solid var(--border);
background: #fff;
}
.docsRunner form {
display: grid;
gap: 14px;
padding: 0 16px 16px;
}
.runnerResult {
display: grid;
gap: 12px;
padding: 16px;
border-top: 1px solid var(--border);
}
.runnerResult pre {
overflow: auto;
max-height: 300px;
margin: 0;
padding: 12px;
border-radius: 8px;
background: #f8fafc;
font-size: 12px;
}
@media (max-width: 1180px) {
.modelCards,
.providerCatalogGrid,
.baseModelGrid,
.pricingRuleGrid {
grid-template-columns: repeat(2, minmax(240px, 1fr));
}
.apiDocsShell {
grid-template-columns: 240px minmax(0, 1fr);
}
.docsRunner {
grid-column: 1 / -1;
border-top: 1px solid var(--border);
border-left: 0;
}
}
@media (max-width: 860px) {
.subPageLayout,
.modelsPage,
.apiDocsShell {
grid-template-columns: 1fr;
}
.sideTabs,
.modelFilters {
position: static;
}
.modelCards,
.providerCatalogGrid,
.baseModelGrid,
.pricingRuleGrid,
.pricingRuleFields,
.pricingRuleFormBody,
.modelCatalogFilters {
grid-template-columns: 1fr;
}
.providerCatalogCard {
grid-template-columns: 48px minmax(0, 1fr);
}
.providerToolbar {
align-items: flex-start;
flex-direction: column;
}
.providerCatalogActions {
grid-column: 1 / -1;
justify-content: flex-start;
}
.paramRow {
grid-template-columns: 1fr;
}
}
+330
View File
@@ -0,0 +1,330 @@
.shCard {
overflow: hidden;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--card);
color: var(--card-foreground);
}
.shCardHeader,
.shCardContent,
.shCardFooter {
padding: 16px;
}
.shCardHeader {
display: flex;
min-height: 60px;
align-items: center;
justify-content: space-between;
gap: 12px;
border-bottom: 1px solid #edf1f5;
}
.shCardTitle {
font-size: 16px;
line-height: 1.3;
}
.shCardDescription,
.mutedText {
color: var(--muted-foreground);
font-size: 13px;
}
.shButton {
display: inline-flex;
min-height: 40px;
align-items: center;
justify-content: center;
gap: 8px;
border: 1px solid transparent;
border-radius: 8px;
font-weight: 800;
line-height: 1;
}
.shButtonDefaultSize {
padding: 0 14px;
}
.shButtonSm {
min-height: 34px;
padding: 0 11px;
font-size: 13px;
}
.shButtonIcon {
width: 36px;
min-height: 36px;
padding: 0;
}
.shButtonDefault {
background: var(--primary);
color: var(--primary-foreground);
}
.shButtonSecondary {
background: var(--secondary);
color: var(--secondary-foreground);
}
.shButtonOutline {
border-color: var(--border);
background: #fff;
color: #344054;
}
.shButtonGhost {
background: transparent;
color: #344054;
}
.shButtonDestructive {
background: var(--destructive);
color: #fff;
}
.formDialogBackdrop {
position: fixed;
z-index: 60;
inset: 0;
display: grid;
place-items: center;
padding: 24px;
background: rgba(15, 23, 42, 0.42);
}
.formDialog {
display: grid;
width: min(720px, 100%);
max-height: min(760px, calc(100vh - 48px));
grid-template-rows: auto minmax(0, 1fr);
overflow: hidden;
border: 1px solid var(--border);
border-radius: 10px;
background: #fff;
box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}
.formDialogHeader {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
padding: 18px;
border-bottom: 1px solid var(--border);
}
.formDialogHeader span {
display: block;
color: var(--muted-foreground);
font-size: 12px;
font-weight: 800;
text-transform: uppercase;
}
.formDialogHeader strong {
display: block;
margin-top: 3px;
font-size: 18px;
}
.formDialogForm {
display: grid;
min-height: 0;
grid-template-rows: minmax(0, 1fr) auto;
}
.formDialogBody {
display: grid;
min-height: 0;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
overflow: auto;
padding: 18px;
}
.formDialogActions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 10px;
padding: 14px 18px;
border-top: 1px solid var(--border);
background: #fff;
box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.06);
}
.shInput,
.shTextarea {
width: 100%;
border: 1px solid var(--input);
border-radius: 8px;
background: #fff;
color: var(--foreground);
outline: none;
}
.shInput {
min-height: 40px;
padding: 0 11px;
}
.shTextarea {
min-height: 96px;
padding: 10px 11px;
resize: vertical;
}
.shInput:focus,
.shTextarea:focus,
.tokenInline input:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px rgba(47, 128, 193, 0.16);
}
.shLabel,
.formGrid {
display: grid;
gap: 8px;
}
.shLabel {
color: #475467;
font-size: 13px;
font-weight: 800;
}
.formGrid {
gap: 12px;
}
.formGrid.two {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.shTabs {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 4px;
border: 1px solid var(--border);
border-radius: 8px;
background: #f8fafc;
}
.shTab {
display: inline-flex;
min-height: 34px;
align-items: center;
gap: 7px;
padding: 0 11px;
border: 0;
border-radius: 7px;
background: transparent;
color: #475467;
font-weight: 800;
}
.shTab[data-active="true"] {
background: #fff;
color: #145388;
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.shBadge {
display: inline-flex;
min-height: 24px;
align-items: center;
width: fit-content;
padding: 0 8px;
border: 1px solid transparent;
border-radius: 999px;
font-size: 12px;
font-weight: 900;
}
.shBadgeDefault { background: #eaf2f8; color: #145388; }
.shBadgeSecondary { background: #eef2f6; color: #475467; }
.shBadgeOutline { border-color: var(--border); background: #fff; color: #344054; }
.shBadgeSuccess { background: #e8f5ef; color: #14805e; }
.shBadgeWarning { background: #fff6df; color: #98690c; }
.shBadgeDestructive { background: #fff1f1; color: #b42318; }
.shTable {
overflow: auto;
}
.shTableRow {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
min-width: 520px;
border-bottom: 1px solid #edf1f5;
}
.shTableHeader {
background: #f8fafc;
}
.shTableHead,
.shTableCell {
overflow: hidden;
min-height: 42px;
padding: 11px 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.shTableHead {
color: var(--muted-foreground);
font-size: 12px;
font-weight: 900;
}
.shTableCell {
color: #344054;
font-size: 13px;
}
.emptyState {
display: grid;
min-height: 104px;
place-items: center;
gap: 8px;
padding: 18px;
color: var(--muted-foreground);
text-align: center;
}
.modelMeta code,
.secretBox,
.codeBlock,
.taskPreview pre {
overflow: auto;
border: 1px solid var(--border);
border-radius: 8px;
background: #f8fafc;
color: #1f2937;
font-family: "SFMono-Regular", Consolas, monospace;
font-size: 12px;
}
.modelMeta code,
.secretBox {
padding: 8px;
}
.codeBlock,
.taskPreview pre {
margin: 0;
padding: 12px;
line-height: 1.5;
}
@media (max-width: 860px) {
.formDialogBody {
grid-template-columns: 1fr;
}
}