Repository navigation
feat(ui): migrate crash and bootstrap screens to design tokens (KR-01c) #1552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| import { Component } from "react"; | ||
| import type { ErrorInfo, ReactNode } from "react"; | ||
| import { Button } from "../design/controls/Button"; | ||
| import { t } from "../i18n/useT"; | ||
| import "../design/tokens.css"; | ||
| import "../design/controls/controls.css"; | ||
| import styles from "./RecoveryScreen.module.css"; | ||
|
|
||
| interface ErrorBoundaryProps { | ||
| children: ReactNode; | ||
|
|
@@ -38,20 +43,22 @@ export default class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBo | |
| const { error } = this.state; | ||
| if (error === null) return this.props.children; | ||
| return ( | ||
| <div className="error-boundary" role="alert"> | ||
| <p className="error-boundary-title"> | ||
| {this.props.label === undefined | ||
| ? "Die Oberfläche ist abgestürzt." | ||
| : `${this.props.label} ist abgestürzt.`} | ||
| </p> | ||
| <p className="error-boundary-detail">{error.message}</p> | ||
| <button | ||
| type="button" | ||
| className="empty-action" | ||
| onClick={() => window.location.reload()} | ||
| > | ||
| Neu laden | ||
| </button> | ||
| <div className={styles.screen} role="alert"> | ||
| <section className={styles.card}> | ||
| <h1 className={styles.title}> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Bei jeder mit Useful? React with 👍 / 👎. |
||
| {this.props.label === undefined | ||
| ? t("recovery.crashed") | ||
| : t("recovery.viewCrashed").replace("{label}", () => this.props.label ?? "")} | ||
| </h1> | ||
| <p className={styles.detail}>{error.message}</p> | ||
| <Button | ||
| variant="primary" | ||
| autoFocus | ||
| onClick={() => window.location.reload()} | ||
| > | ||
| {t("recovery.reload")} | ||
| </Button> | ||
| </section> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| .screen { | ||
| box-sizing: border-box; | ||
| display: grid; | ||
| place-items: center; | ||
| flex: 1; | ||
| width: 100%; | ||
| min-width: 0; | ||
| min-height: 100%; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Wenn eine der ansichtsspezifischen Error Boundaries in Useful? React with 👍 / 👎. |
||
| padding: var(--g-pad); | ||
| overflow: auto; | ||
| background: var(--g-ground); | ||
| color: var(--g-ink); | ||
| font: 400 14px/1.6 var(--g-font-sans); | ||
| } | ||
| .card { | ||
| box-sizing: border-box; | ||
| display: grid; | ||
| justify-items: center; | ||
| gap: 16px; | ||
| width: min(100%, 560px); | ||
| padding: calc(var(--g-pad) * 2); | ||
| border: 1px solid var(--g-line); | ||
| border-radius: var(--g-r-panel); | ||
| background: var(--g-content-bg); | ||
| text-align: center; | ||
| } | ||
| .title { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; } | ||
| .hint { margin: 0; color: var(--g-muted); } | ||
| .detail { margin: 0; max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; font-family: var(--g-font-mono); } | ||
| .mark { color: var(--g-accent); font-size: 24px; } | ||
| .spinner { | ||
| width: 24px; | ||
| height: 24px; | ||
| border: 2px solid var(--g-line); | ||
| border-top-color: var(--g-accent); | ||
| border-radius: 50%; | ||
| animation: spin 1s linear infinite; | ||
| } | ||
| @keyframes spin { to { transform: rotate(360deg); } } | ||
| @media (prefers-reduced-motion: reduce) { .spinner { animation: none; } } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solange
bootstrapReadyfalsch ist, ist dieses<main>direktes Kind von.app, deren Grid weiterhin aus der 248-px-Seitenleiste und der Inhaltsfläche besteht. Durch den Austausch von.bootstrap-screenentfällt dessengrid-column: 1 / -1; der Lade- beziehungsweise Fehlerbildschirm wird daher automatisch nur in der ersten Spalte platziert, statt das Fenster auszufüllen. Verwende für den Bootstrap-Fall zusätzlich eine modulare Klasse, die beide Spalten überspannt.Useful? React with 👍 / 👎.