From c263497ec8b05bc0f9254ed2f7ecb4dba6f67d4e Mon Sep 17 00:00:00 2001 From: Kostya Date: Thu, 15 Oct 2026 19:35:48 +0300 Subject: ui-web: add browser client for the Ex4 bonus A React + TypeScript single-page client served by Vite, working against the same servlets as the desktop client: login, the events screen with filters, details, order books and trading, and the account screen with deposit, holdings, ledger rows and the user directory. No file upload, as the exercise specifies. It looks like the desktop client on purpose: the three skins of theme.css as CSS variables, the four animations redone with SVG and keyframes, and the desktop's Nerd Fonts, which npm run dev copies from ui-fx instead of keeping a second copy in the repo. The shared chat sits in a drawer above the status bar, as on the desktop, on its own poll because chat lines don't move the market version. Vite forwards /guess-market to Tomcat on 8080, so the page and the API share an origin and the session cookie needs no CORS. The client polls /api/sync once a second and reloads only when the version moved. run-web.bat installs the packages and starts it on localhost:5173. package.sh stages the sources under build/dist/ex4, without node_modules. --- ui-web/src/styles.css | 1068 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1068 insertions(+) create mode 100644 ui-web/src/styles.css (limited to 'ui-web/src/styles.css') diff --git a/ui-web/src/styles.css b/ui-web/src/styles.css new file mode 100644 index 0000000..028e2d2 --- /dev/null +++ b/ui-web/src/styles.css @@ -0,0 +1,1068 @@ + +@font-face { + font-family: 'CaskaydiaCove NF'; + src: url('/fonts/CaskaydiaCoveNerdFont-Regular.ttf'); +} +@font-face { + font-family: 'CaskaydiaCove NF'; + font-weight: bold; + src: url('/fonts/CaskaydiaCoveNerdFont-Bold.ttf'); +} +@font-face { + font-family: 'JetBrainsMono NF'; + src: url('/fonts/JetBrainsMonoNerdFont-Regular.ttf'); +} +@font-face { + font-family: 'JetBrainsMono NF'; + font-weight: bold; + src: url('/fonts/JetBrainsMonoNerdFont-Bold.ttf'); +} +@font-face { + font-family: 'FiraCode Nerd Font'; + src: url('/fonts/FiraCodeNerdFont-Regular.ttf'); +} +@font-face { + font-family: 'FiraCode Nerd Font'; + font-weight: bold; + src: url('/fonts/FiraCodeNerdFont-Bold.ttf'); +} + +:root, +:root[data-skin='rose-pine-dawn'] { + --font: 'CaskaydiaCove NF', Consolas, monospace; + --size: 13px; + --bg: #faf4ed; + --panel: #fffaf3; + --panel2: #f2e9e1; + --panel3: #dfdad9; + --line: #cecacd; + --ink: #575279; + --ink2: #797593; + --accent: #907aa9; + --accent-fg: #fffaf3; + --btn: #f2e9e1; + --btn-line: #cecacd; + --yes: #286983; + --no: #b4637a; + --yes-soft: #e3edf0; + --no-soft: #f5e6ea; +} + +:root[data-skin='catppuccin'] { + --font: 'JetBrainsMono NF', Consolas, monospace; + --bg: #181825; + --panel: #1e1e2e; + --panel2: #313244; + --panel3: #45475a; + --line: #585b70; + --ink: #cdd6f4; + --ink2: #a6adc8; + --accent: #cba6f7; + --accent-fg: #1e1e2e; + --btn: #313244; + --btn-line: #585b70; + --yes: #a6e3a1; + --no: #f38ba8; + --yes-soft: #23312a; + --no-soft: #34232c; +} + +:root[data-skin='gruvbox'] { + --font: 'FiraCode Nerd Font', Consolas, monospace; + --size: 13.5px; + --bg: #1d2021; + --panel: #282828; + --panel2: #3c3836; + --panel3: #504945; + --line: #665c54; + --ink: #ebdbb2; + --ink2: #a89984; + --accent: #fe8019; + --accent-fg: #1d2021; + --btn: #3c3836; + --btn-line: #665c54; + --yes: #b8bb26; + --no: #fb4934; + --yes-soft: #2b3021; + --no-soft: #3b2320; +} + + box-sizing: border-box; +} +html, +body, + height: 100%; +} +body { + margin: 0; + background: var(--bg); + color: var(--ink); + font: var(--size) / 1.35 var(--font); +} +h1, +h2, +h3, +p { + margin: 0; + font-weight: inherit; +} + +.ink2 { + color: var(--ink2); +} +.accent { + color: var(--accent); +} +.yes { + color: var(--yes); +} +.no { + color: var(--no); +} +.bold { + font-weight: 700; +} +.xs { + font-size: 10.5px; +} +.sm { + font-size: 11.5px; +} +.base { + font-size: 12.5px; +} +.lg { + font-size: 14px; +} +.xl { + font-size: 17px; +} +.grow { + flex: 1; + min-width: 0; +} +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.row { + display: flex; + align-items: center; + gap: 8px; +} +.num { + text-align: right; + white-space: nowrap; +} + +button, +input, +select { + font: inherit; + color: inherit; +} +button { + cursor: pointer; +} +button:disabled { + opacity: 0.45; + cursor: default; +} +:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 1px; +} +.btn { + border: 1px solid var(--btn-line); + border-radius: 5px; + background: var(--btn); + font-size: 13px; + font-weight: 700; + padding: 8px 15px; + white-space: nowrap; +} +.btn:hover:not(:disabled) { + opacity: 0.92; +} +.btn.primary { + background: var(--accent); + border-color: var(--accent); + color: var(--accent-fg); +} +.btn.destructive { + background: var(--no); + border-color: var(--no); + color: var(--accent-fg); +} +.btn.icon { + padding: 4px 8px; + min-width: 34px; + height: 30px; + display: grid; + place-items: center; +} +.btn.icon.on { + background: var(--panel3); + border-color: var(--accent); +} +.toggle { + border: 1px solid var(--btn-line); + border-radius: 4px; + background: var(--btn); + color: var(--ink2); + font-size: 12px; + padding: 5px 11px; +} +.toggle.on { + background: var(--accent); + border-color: var(--accent); + color: var(--accent-fg); +} +.seg { + border: 1px solid var(--btn-line); + background: var(--btn); + font-size: 12px; + font-weight: 700; + padding: 8px 15px; +} +.seg:first-child { + border-radius: 5px 0 0 5px; +} +.seg:last-child { + border-radius: 0 5px 5px 0; + border-left: 0; +} +.seg.on { + background: var(--accent); + color: var(--accent-fg); +} +.field { + background: var(--panel2); + border: 1px solid var(--btn-line); + border-radius: 5px; + padding: 8px 10px; + font-size: 13px; + color: var(--ink); + width: 96px; +} +.field.bad { + border-color: var(--no); + border-width: 1.5px; +} +.select { + background: var(--btn); + border: 1px solid var(--btn-line); + border-radius: 5px; + padding: 6px 8px; + font-size: 12.5px; +} + +.pill { + display: inline-flex; + align-items: center; + gap: 7px; + border-radius: 3px; + padding: 3px 6px; + font-size: 10px; + font-weight: 700; + background: var(--panel3); + color: var(--ink2); + white-space: nowrap; +} +.pill.active { + background: var(--yes-soft); + color: var(--yes); +} +.pill.closed { + background: var(--no-soft); + color: var(--no); +} +.pill.mm { + background: var(--accent); + color: var(--accent-fg); +} +.pill.blocked { + background: var(--no); + color: var(--accent-fg); +} +.pill.resolved { + background: var(--yes); + color: var(--accent-fg); +} + +.card { + background: var(--panel); + border: 1px solid var(--line); + border-radius: 7px; +} +.card2 { + background: var(--panel2); + border: 1px solid var(--line); + border-radius: 6px; +} +.table { + background: var(--panel); + border: 1px solid var(--line); + border-radius: 6px; + overflow: hidden; +} +.thead, +.trow { + display: flex; + align-items: center; + gap: 8px; + padding: 8px 11px; +} +.thead { + background: var(--panel3); + color: var(--ink2); + font-size: 10.5px; + font-weight: 700; +} +.trow { + border-top: 1px solid var(--line); + font-size: 11.5px; +} +.trow.click { + cursor: pointer; +} +.trow.click:hover { + background: var(--panel2); +} +.trow.on { + background: var(--panel3); +} +.trow.bid { + background: var(--yes-soft); +} +.trow.ask { + background: var(--no-soft); +} +.w54 { + width: 54px; +} +.w66 { + width: 66px; +} +.w78 { + width: 78px; +} +.w92 { + width: 92px; +} +.w150 { + width: 150px; +} + +.app { + display: flex; + flex-direction: column; + height: 100%; + min-width: 1040px; +} +.windowbar { + display: flex; + align-items: center; + gap: 10px; + height: 32px; + padding: 0 14px; + background: var(--panel2); + border-bottom: 1px solid var(--line); + font-size: 12.5px; + font-weight: 700; + color: var(--ink2); +} +.toolbar { + display: flex; + align-items: center; + gap: 12px; + padding: 12px 16px; + background: var(--panel); + border-bottom: 1px solid var(--line); +} +.path { + display: flex; + align-items: center; + gap: 10px; + padding: 8px 12px; + font-size: 12.5px; +} +.tabs { + display: flex; + align-items: flex-end; + gap: 2px; + padding: 6px 16px 0; + background: var(--panel); + border-bottom: 1px solid var(--line); +} +.tab { + border: 1px solid var(--line); + border-bottom: 0; + border-radius: 6px 6px 0 0; + background: var(--panel2); + color: var(--ink2); + font-size: 13px; + font-weight: 700; + padding: 9px 20px; + margin-bottom: -1px; +} +.tab.on { + background: var(--bg); + color: var(--ink); +} +.tabinfo { + display: flex; + align-items: center; + gap: 8px; + padding: 0 4px 8px; + font-size: 12.5px; + color: var(--ink2); +} +.content { + flex: 1; + min-height: 0; + display: flex; + gap: 12px; + padding: 12px 16px; +} +.statusbar { + display: flex; + align-items: center; + height: 30px; + padding: 0 14px; + background: var(--panel2); + border-top: 1px solid var(--line); + font-size: 11.5px; + color: var(--ink2); + white-space: pre; +} +.chatbtn { + border: 0; + background: none; + padding: 0 2px; + color: var(--ink2); + font-size: 14.5px; + cursor: pointer; +} +.chatbtn.on { + color: var(--accent); +} +.chat { + position: fixed; + right: 14px; + bottom: 31px; + width: 320px; + height: 380px; + display: flex; + flex-direction: column; + gap: 8px; + padding: 12px; + white-space: normal; + color: var(--ink); + box-shadow: 0 4px 18px rgb(0 0 0 / 0.3); + z-index: 2; +} +.chatlist { + flex: 1; + min-height: 0; + overflow-y: auto; + display: flex; + flex-direction: column; + gap: 9px; + overflow-wrap: anywhere; +} +.banner { + padding: 8px 16px; + font-weight: 700; + background: var(--no-soft); + color: var(--no); + border-bottom: 1px solid var(--no); +} +.toast { + position: fixed; + left: 50%; + bottom: 44px; + transform: translateX(-50%); + max-width: 90vw; + background: var(--ink); + color: var(--bg); + border-radius: 6px; + padding: 10px 16px; + font-size: 12.5px; + font-weight: 700; + z-index: 3; +} +.empty { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 14px; + text-align: center; +} + +.side { + display: flex; + flex-direction: column; + gap: 6px; + padding: 12px; +} +.side.events { + width: 498px; +} +.side.users { + width: 274px; +} +.main { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; +} +.head { + display: flex; + align-items: flex-start; + gap: 14px; + padding: 14px 16px; + border-bottom: 1px solid var(--line); +} +.body { + flex: 1; + min-height: 0; + overflow-y: auto; + display: flex; + flex-direction: column; + gap: 14px; + padding: 14px 16px; +} +.body > * { + flex-shrink: 0; +} +.section { + display: flex; + flex-direction: column; + gap: 7px; +} +.section-title { + display: flex; + align-items: baseline; + gap: 8px; + font-size: 12.5px; + font-weight: 700; +} +.filter { + display: flex; + align-items: center; + gap: 8px; + margin-bottom: 4px; +} +.filter > span { + width: 74px; + font-size: 12.5px; + color: var(--ink2); +} +.list { + flex: 1; + min-height: 0; + overflow-y: auto; + display: flex; + flex-direction: column; + gap: 2px; +} +.listrow { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + text-align: left; + background: transparent; + border: 0; + border-left: 3px solid transparent; + border-radius: 5px; + padding: 9px 11px; +} +.listrow:hover { + background: var(--panel2); +} +.listrow.on { + background: var(--panel3); + border-left-color: var(--accent); +} +.listrow.plain { + cursor: default; +} +.meta { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 4px 16px; + font-size: 12.5px; +} +.meta b { + font-weight: 700; +} +.pair { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; +} +.optcard { + border: 1px solid var(--line); + border-radius: 6px; + padding: 12px 14px; + display: flex; + flex-direction: column; + gap: 8px; +} +.optcard.yes { + background: var(--yes-soft); +} +.optcard.no { + background: var(--no-soft); +} +.optcard.pick { + background: var(--panel); + cursor: pointer; + text-align: left; + color: var(--ink); + padding: 10px 12px; + gap: 6px; +} +.optcard.pick.yes.on { + background: var(--yes-soft); + border: 1.5px solid var(--yes); +} +.optcard.pick.no.on { + background: var(--no-soft); + border: 1.5px solid var(--no); +} +.bar { + height: 6px; + border-radius: 3px; + background: var(--panel3); + overflow: hidden; +} +.bar i { + display: block; + height: 100%; + border-radius: 3px; + background: currentColor; + transition: width 0.3s; +} +.stats { + display: flex; + gap: 16px; + padding: 8px 11px; + font-size: 11.5px; +} +.stats span { + display: flex; + flex-direction: column; + gap: 2px; +} +.tradeform { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + gap: 10px; +} +.tradeform label { + display: flex; + flex-direction: column; + gap: 5px; + font-size: 12.5px; + color: var(--ink2); +} +.balance { + font-size: 22px; + font-weight: 700; + color: var(--accent); +} +.balance.neg, +.neg { + color: var(--no); +} +.balcell { + font-weight: 700; + color: var(--accent); +} +.pnl { + font-size: 12px; + font-weight: 700; + color: var(--yes); +} +.notice { + display: flex; + align-items: center; + gap: 11px; + padding: 11px 13px; + border-radius: 6px; + border: 1px solid var(--line); + background: var(--yes-soft); + font-size: 12.5px; +} +.notice.blocked { + background: var(--no-soft); + border-color: var(--no); +} + +.chart { + display: grid; + grid-template-columns: auto 1fr; + gap: 4px 6px; + padding: 10px; + font-size: 10px; + color: var(--ink2); +} +.chart .yaxis { + display: flex; + flex-direction: column; + justify-content: space-between; + text-align: right; + border-right: 1px solid var(--line); + padding-right: 6px; + line-height: 1; +} +.chart .xaxis { + grid-column: 2; + display: flex; + justify-content: space-between; + border-top: 1px solid var(--line); + padding-top: 4px; +} +.chart svg { + width: 100%; + display: block; +} +.chart .grid { + stroke: var(--line); + stroke-width: 1; + opacity: 0.6; +} +.chart path { + fill: none; + stroke-width: 2.5; + stroke-linejoin: round; + vector-effect: non-scaling-stroke; +} +.chart line { + vector-effect: non-scaling-stroke; +} +.stroke-accent { + stroke: var(--accent); +} +.stroke-yes { + stroke: var(--yes); +} +.stroke-no { + stroke: var(--no); +} + +.scrim { + position: fixed; + inset: 0; + display: grid; + place-items: center; + background: rgba(10, 10, 10, 0.42); + z-index: 2; +} +.dialog { + width: 430px; + max-width: calc(100vw - 32px); +} +.dialog > header { + padding: 16px 20px; + border-bottom: 1px solid var(--line); + font-size: 14px; + font-weight: 700; +} +.dialog > div { + display: flex; + flex-direction: column; + gap: 10px; + padding: 18px 20px; +} +.dialog > footer { + display: flex; + justify-content: flex-end; + gap: 9px; + padding: 14px 20px; + border-top: 1px solid var(--line); +} +.resolveopt { + flex: 1; + border: 1px solid var(--line); + border-radius: 6px; + background: var(--panel2); + font-size: 14px; + font-weight: 700; + padding: 14px 6px; +} +.resolveopt.yes.on { + background: var(--yes-soft); + border: 1.5px solid var(--yes); +} +.resolveopt.no.on { + background: var(--no-soft); + border: 1.5px solid var(--no); +} + +.login { + height: 100%; + display: grid; + place-items: center; + padding: 24px; +} +.login form { + width: 380px; + max-width: 100%; + display: flex; + flex-direction: column; + gap: 8px; + padding: 20px 22px; +} +.login .field { + width: 100%; +} + +.eq rect { + fill: var(--ink2); + transform-box: fill-box; + transform-origin: bottom; +} +.pill.active .eq rect { + fill: var(--yes); +} +.pill.closed .eq rect { + fill: var(--no); +} +.eq .b0 { + transform: scaleY(0.35); +} +.eq .b1 { + transform: scaleY(0.8); +} +.eq .b2 { + transform: scaleY(0.55); +} +.anim .eq .b0 { + animation: eq0 3.6s linear infinite; +} +.anim .eq .b1 { + animation: eq1 3.6s linear infinite; +} +.anim .eq .b2 { + animation: eq2 3.6s linear infinite; +} +@keyframes eq0 { + 0%, + 100% { + transform: scaleY(0.35); + } + 30% { + transform: scaleY(1); + } + 60% { + transform: scaleY(0.6); + } +} +@keyframes eq1 { + 0%, + 100% { + transform: scaleY(0.8); + } + 25% { + transform: scaleY(0.3); + } + 70% { + transform: scaleY(1); + } +} +@keyframes eq2 { + 0%, + 100% { + transform: scaleY(0.55); + } + 45% { + transform: scaleY(1); + } + 80% { + transform: scaleY(0.4); + } +} + +.draw { + fill: none; + stroke-linecap: round; + stroke-linejoin: round; + stroke-dasharray: 100; + stroke-dashoffset: 0; +} +.rider { + offset-rotate: 0deg; + offset-distance: 100%; +} +.spark .draw { + stroke: var(--accent); + stroke-width: 2; +} +.spark .rider { + fill: var(--accent); + offset-path: path('M2 20 L14 16 L26 22 L38 11 L50 14 L62 5'); +} +.spark.neg .draw { + stroke: var(--no); +} +.spark.neg .rider { + fill: var(--no); +} +.anim .spark .draw { + animation: draw70 3.6s infinite; +} +.anim .spark .rider { + animation: + ride70 3.6s infinite, + appear 3.6s linear infinite; +} +@keyframes draw70 { + 0% { + stroke-dashoffset: 100; + animation-timing-function: ease-in-out; + } + 70%, + 100% { + stroke-dashoffset: 0; + } +} +@keyframes ride70 { + 0% { + offset-distance: 0%; + animation-timing-function: ease-in-out; + } + 70%, + 100% { + offset-distance: 100%; + } +} +@keyframes appear { + 0% { + opacity: 0; + } + 8%, + 100% { + opacity: 1; + } +} + +.mchart .rule { + stroke: var(--line); +} +.mchart text { + fill: var(--ink2); + font-size: 9px; + opacity: 0.7; +} +.mchart .draw { + stroke-width: 2.5; +} +.mchart .y { + stroke: var(--yes); +} +.mchart .n { + stroke: var(--no); +} +.mchart .rider.y { + fill: var(--yes); + stroke: none; + offset-path: path('M22 66 C96 64 150 22 224 22'); +} +.mchart .rider.n { + fill: var(--no); + stroke: none; + offset-path: path('M22 66 C96 68 150 110 224 110'); +} +.anim .mchart .draw { + animation: draw55 3.6s infinite; +} +.anim .mchart .rider { + animation: + ride55 3.6s infinite, + appear 3.6s linear infinite; +} +.anim .mchart text { + animation: breathe 3.6s linear infinite; +} +.anim .mchart text.lo { + animation-delay: -3.2s; +} +@keyframes draw55 { + 0% { + stroke-dashoffset: 100; + animation-timing-function: ease-in-out; + } + 55%, + 100% { + stroke-dashoffset: 0; + } +} +@keyframes ride55 { + 0% { + offset-distance: 0%; + animation-timing-function: ease-in-out; + } + 55%, + 100% { + offset-distance: 100%; + } +} +@keyframes breathe { + 0%, + 100% { + opacity: 0.25; + } + 50% { + opacity: 0.7; + } +} + +.pinwheel path { + fill: var(--ink2); +} +.pinwheel circle { + fill: var(--panel); + stroke: var(--ink2); +} +.btn.icon.on .pinwheel path { + fill: var(--accent); +} +.btn.icon.on .pinwheel circle { + stroke: var(--accent); +} +.pinwheel g { + transform-origin: 10px 10px; +} +.anim .pinwheel g { + animation: spin 2.4s linear infinite; +} +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +.anim .fade { + animation: fade 0.5s; +} +@keyframes fade { + from { + opacity: 0; + } +} + +@media (prefers-reduced-motion: reduce) { + .anim * { + animation: none !important; + } +} -- cgit v1.2.3