feat: add local autosave history prototype

This commit is contained in:
QiuSW
2026-08-04 23:00:05 +08:00
parent b62e9697a4
commit a82af6939f
31 changed files with 1730 additions and 73 deletions
+709
View File
@@ -202,6 +202,583 @@ a:focus-visible {
padding-top: clamp(36px, 9vh, 72px);
}
.page--home {
padding-top: 28px;
padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
.home-intro h1 {
max-width: 10em;
margin-bottom: 12px;
font-size: clamp(31px, 9vw, 38px);
}
.home-intro .lede {
margin-bottom: 20px;
}
.home-primary {
width: 100%;
}
.home-shelf {
margin-top: 32px;
padding-top: 24px;
border-top: 1px solid var(--outline-soft);
}
.home-shelf__heading {
margin-bottom: 13px;
}
.home-shelf__heading h2 {
font-size: 21px;
}
.home-shelf__heading .text-link {
min-height: 48px;
padding-right: 0;
font-size: 13px;
}
.recent-card,
.home-empty-card,
.history-card {
width: 100%;
color: var(--ink);
background: rgb(255 253 247 / 76%);
border: 1px solid var(--outline-soft);
border-radius: var(--radius-md);
cursor: pointer;
text-align: left;
transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
touch-action: manipulation;
}
.recent-card:hover,
.home-empty-card:hover,
.history-card:hover {
background: var(--surface);
border-color: var(--outline);
box-shadow: var(--shadow-soft);
transform: translateY(-1px);
}
.recent-card:active,
.home-empty-card:active,
.history-card:active {
transform: scale(.995);
}
.recent-card {
display: grid;
min-height: 154px;
padding: 15px 16px;
gap: 5px;
}
.recent-card__top,
.recent-card__meta,
.history-card__top,
.history-card__footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.recent-card__top,
.history-card__top {
color: var(--ink-faint);
font-size: 11px;
font-weight: 700;
}
.recent-card__route,
.history-card__route {
font-family: var(--serif);
font-size: 24px;
font-weight: 700;
line-height: 1.35;
}
.recent-card__route span,
.history-card__route span {
margin: 0 4px;
color: var(--outline);
font-size: 14px;
font-weight: 500;
}
.recent-card__question,
.history-card__question {
overflow: hidden;
color: var(--ink-soft);
font-size: 13px;
text-overflow: ellipsis;
white-space: nowrap;
}
.recent-card__meta,
.history-card__footer {
color: var(--ink-faint);
font-size: 11px;
}
.recent-card__meta svg,
.history-card__footer svg,
.home-empty-card > svg {
width: 18px;
height: 18px;
flex: 0 0 18px;
fill: none;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
}
.recent-card__meta span:nth-child(2) {
margin-left: auto;
}
.home-empty-card {
display: grid;
min-height: 86px;
padding: 14px;
grid-template-columns: 44px 1fr 20px;
align-items: center;
gap: 12px;
}
.home-empty-card__icon {
display: grid;
width: 44px;
height: 44px;
color: var(--ochre);
background: var(--surface-muted);
border-radius: 50%;
place-items: center;
}
.home-empty-card__icon svg,
.button > svg {
width: 20px;
height: 20px;
fill: none;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
}
.home-empty-card strong,
.home-empty-card small {
display: block;
}
.home-empty-card small {
margin-top: 2px;
color: var(--ink-faint);
font-size: 11px;
}
.local-data-card {
display: grid;
margin-top: 14px;
padding: 14px;
grid-template-columns: 36px 1fr;
align-items: start;
gap: 11px;
color: var(--ink-soft);
background: #edf1e9;
border: 1px solid #d0dacb;
border-radius: var(--radius-sm);
}
.local-data-card__icon {
display: grid;
width: 36px;
height: 36px;
color: var(--success);
background: rgb(255 255 255 / 64%);
border-radius: 50%;
place-items: center;
}
.local-data-card__icon svg {
width: 18px;
height: 18px;
fill: none;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
}
.local-data-card strong {
display: block;
color: #304c39;
font-size: 13px;
line-height: 1.55;
}
.local-data-card p {
margin: 3px 0 0;
font-size: 12px;
}
.local-data-card .text-link {
margin-bottom: -8px;
color: #405e49;
font-size: 12px;
}
.page--history {
padding-top: 28px;
}
.history-title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.history-title-row h1 {
margin-bottom: 8px;
}
.privacy-strip {
display: flex;
margin: 20px 0;
padding: 12px 13px;
align-items: flex-start;
gap: 10px;
color: var(--ink-soft);
background: rgb(255 253 247 / 62%);
border: 1px solid var(--outline-soft);
border-radius: var(--radius-sm);
font-size: 12px;
}
.privacy-strip svg {
width: 18px;
height: 18px;
flex: 0 0 18px;
fill: none;
stroke: var(--ochre);
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
}
.history-list {
display: grid;
margin: 0;
padding: 0;
gap: 12px;
list-style: none;
}
.history-card {
display: grid;
min-height: 132px;
padding: 15px 16px;
gap: 5px;
}
.history-card__route {
font-size: 22px;
}
.history-card__footer {
justify-content: flex-end;
}
.history-card__footer span {
margin-right: auto;
}
.history-empty {
display: grid;
min-height: 330px;
padding: 34px 20px;
align-content: center;
justify-items: center;
color: var(--ink-soft);
text-align: center;
}
.history-empty__mark {
display: grid;
width: 92px;
height: 92px;
margin-bottom: 22px;
place-content: center;
gap: 11px;
border: 1px solid var(--outline-soft);
border-radius: 50%;
}
.history-empty__mark i {
display: block;
width: 44px;
height: 5px;
background: var(--ink);
}
.history-empty__mark i:last-child {
background: linear-gradient(90deg, var(--ink) 0 40%, transparent 40% 60%, var(--ink) 60%);
}
.history-empty h2 {
margin-bottom: 8px;
font-size: 22px;
}
.history-empty p {
max-width: 23em;
margin: 0;
font-size: 13px;
}
.page--settings {
padding-top: 28px;
}
.page--settings > h1 {
margin-bottom: 10px;
}
.settings-boundary {
display: grid;
margin: 22px 0 16px;
padding: 15px;
grid-template-columns: 40px 1fr;
align-items: start;
gap: 12px;
color: var(--ink-soft);
background: #e9efe7;
border: 1px solid #cfdbcc;
border-radius: var(--radius-md);
}
.settings-boundary > svg {
width: 24px;
height: 24px;
margin: 5px auto 0;
fill: none;
stroke: var(--success);
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
}
.settings-boundary strong,
.settings-boundary p {
display: block;
}
.settings-boundary p {
margin: 3px 0 0;
font-size: 12px;
}
.settings-card {
overflow: hidden;
background: rgb(255 253 247 / 80%);
border: 1px solid var(--outline-soft);
border-radius: var(--radius-md);
box-shadow: var(--shadow-soft);
}
.settings-card__details {
margin-left: 16px;
border-left: 2px solid var(--cinnabar-soft);
}
.settings-card__details--disabled {
background: rgb(221 211 196 / 18%);
}
.setting-row {
display: grid;
min-height: 78px;
padding: 13px 15px;
grid-template-columns: 1fr 52px;
align-items: center;
gap: 14px;
cursor: pointer;
}
.setting-row + .setting-row,
.settings-card__details .setting-row:first-child {
border-top: 1px solid var(--outline-soft);
}
.setting-row--detail {
min-height: 72px;
padding-left: 13px;
}
.setting-row--disabled {
cursor: not-allowed;
opacity: .5;
}
.setting-row__copy strong,
.setting-row__copy small {
display: block;
}
.setting-row__copy strong {
font-size: 14px;
}
.setting-row__copy small {
margin-top: 3px;
color: var(--ink-faint);
font-size: 11px;
line-height: 1.5;
}
.switch-control {
position: relative;
width: 52px;
height: 32px;
margin: 0;
appearance: none;
background: #cfc5b7;
border: 1px solid #b8ad9e;
border-radius: 999px;
cursor: pointer;
transition: background-color 180ms ease, border-color 180ms ease;
}
.switch-control::after {
position: absolute;
top: 3px;
left: 3px;
width: 24px;
height: 24px;
background: var(--surface);
border-radius: 50%;
box-shadow: 0 2px 6px rgb(47 36 25 / 18%);
content: "";
transition: transform 180ms ease;
}
.switch-control:checked {
background: var(--cinnabar);
border-color: var(--cinnabar);
}
.switch-control:checked::after {
transform: translateX(20px);
}
.switch-control:disabled {
cursor: not-allowed;
}
.settings-ai-note {
margin: 14px 2px 26px;
color: var(--ink-faint);
font-size: 12px;
line-height: 1.7;
}
.settings-danger {
padding-top: 20px;
border-top: 1px solid var(--outline-soft);
}
.settings-danger h2 {
margin-bottom: 4px;
font-size: 19px;
}
.settings-danger p {
margin-bottom: 13px;
color: var(--ink-faint);
font-size: 12px;
}
.settings-danger .button {
width: 100%;
}
.history-detail-header h1 {
max-width: none;
margin-bottom: 4px;
font-size: 32px;
}
.history-detail-header h1 span {
color: var(--outline);
font-size: 18px;
}
.history-detail-header > p:last-child {
color: var(--ink-faint);
font-size: 12px;
}
.history-result-hero {
margin-top: 20px;
border: 1px solid var(--outline-soft);
border-radius: var(--radius-md);
}
.record-facts {
margin: 0;
overflow: hidden;
background: rgb(255 253 247 / 70%);
border: 1px solid var(--outline-soft);
border-radius: var(--radius-md);
}
.record-facts div {
display: grid;
padding: 13px 15px;
grid-template-columns: 82px 1fr;
gap: 10px;
}
.record-facts div + div {
border-top: 1px solid var(--outline-soft);
}
.record-facts dt {
color: var(--ink-faint);
font-size: 12px;
}
.record-facts dd {
margin: 0;
color: var(--ink-soft);
font-size: 13px;
text-align: right;
}
.detail-danger-zone {
margin-top: 32px;
padding-top: 20px;
border-top: 1px solid var(--outline-soft);
}
.detail-danger-zone .button {
width: 100%;
}
.detail-danger-zone p {
margin: 7px 0 0;
color: var(--ink-faint);
font-size: 11px;
text-align: center;
}
@keyframes page-in {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
@@ -417,6 +994,15 @@ h3 {
border-color: rgb(155 52 45 / 28%);
}
.button--danger {
color: white;
background: var(--error);
}
.button--danger:hover {
background: #812a25;
}
.button:disabled {
color: #91877a;
background: #ded6c9;
@@ -453,6 +1039,11 @@ h3 {
cursor: pointer;
}
.text-link--danger {
color: var(--error);
text-decoration-color: rgb(155 52 45 / 35%);
}
.stepper {
display: flex;
align-items: center;
@@ -995,6 +1586,99 @@ h3 {
border: 0;
}
.result-secondary-actions {
display: grid;
margin-top: 14px;
gap: 4px;
}
.current-save-panel {
display: grid;
padding: 13px 14px 4px;
gap: 6px;
color: var(--success);
background: #e7eee6;
border: 1px solid #cbdacb;
border-radius: var(--radius-sm);
}
.current-save-panel--off {
padding-bottom: 13px;
color: var(--ink-soft);
background: rgb(255 253 247 / 72%);
border-color: var(--outline-soft);
}
.current-save-panel__status {
display: grid;
min-height: 46px;
grid-template-columns: 36px 1fr;
align-items: center;
gap: 10px;
}
.current-save-panel__icon {
display: grid;
width: 36px;
height: 36px;
background: rgb(255 255 255 / 62%);
border-radius: 50%;
place-items: center;
}
.current-save-panel__icon svg {
width: 19px;
height: 19px;
fill: none;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.7;
}
.current-save-panel__status strong,
.current-save-panel__status small {
display: block;
}
.current-save-panel__status strong {
font-size: 14px;
}
.current-save-panel__status small {
margin-top: 2px;
color: #526858;
font-size: 11px;
}
.current-save-panel--off .current-save-panel__status small {
color: var(--ink-faint);
}
.current-save-panel__actions {
display: grid;
grid-template-columns: 1fr 1fr;
border-top: 1px solid rgb(62 99 74 / 18%);
}
.current-save-panel__actions .text-link {
justify-content: center;
font-size: 12px;
}
.current-save-panel__actions .text-link + .text-link {
border-left: 1px solid rgb(62 99 74 / 18%);
}
.current-save-panel--off > .button {
width: 100%;
margin-top: 4px;
}
.current-save-panel--compact {
margin-bottom: 4px;
}
.interpretation-header {
margin-bottom: 20px;
}
@@ -1138,6 +1822,10 @@ h3 {
animation: sheet-in 240ms cubic-bezier(.2, .8, .2, 1) both;
}
.modal-sheet--dialog {
margin-bottom: max(18px, env(safe-area-inset-bottom));
}
.modal-handle {
width: 42px;
height: 4px;
@@ -1256,6 +1944,27 @@ h3 {
accent-color: var(--cinnabar);
}
.consent-check strong,
.consent-check small {
display: block;
}
.consent-check small {
margin-top: 2px;
color: var(--ink-faint);
font-size: 11px;
}
.notice--danger {
color: #71322d;
background: #fff3f0;
border-color: #e4b9b3;
}
.notice--danger svg {
stroke: var(--error);
}
.modal-actions {
display: grid;
margin-top: 14px;