Files
TREK/client/src/native/nativeApp.css
T
Maurice 32de7adbf6 feat(native): app sign-in screen that continues the address screen
Inside the iOS and Android app the sign-in page looked like the web form it
is in a browser: a white card on grey, the web header and a language menu,
reached through a white page, a grey spinner and another white page, and left
through the 2.6 s takeoff animation.

- AppLogin: the address screen's landscape with the connected server on its
  glass card (Change leads back to the address screen), and its fields,
  buttons and type on the same warm page. Same useLogin hook, so password,
  remember me, forgot password, SSO, OIDC-only, passkey, demo, MFA, password
  change, registration and invites all stay as they are.
- The app speaks the device language with English as the fallback; no
  language menu there.
- Handover: theme-boot.js marks a page inside the app that nobody signed in
  to yet, which then starts on the address screen's colour, waits with its
  spinner, and fades the sign-in screen in. After signing in the screen steps
  back while the settings load and the app rises in, instead of the takeoff.
- Android: the WebView and window keep the address screen's colour across the
  restart onto the server, and the status bar icons stay readable where an
  older WebView lays the page out below the bar (shell and sign-in).
- loginModel holds the headings, button labels and SSO links both sign-in
  screens share.

The browser's sign-in page is unchanged.
2026-11-27 21:42:39 +01:00

131 lines
4.4 KiB
CSS

/*
* What the UI does differently inside the iOS and Android app, keyed on the
* attributes native/nativeApp.ts puts on <html> there (data-native-app, and
* data-touch-input while a finger drives it). A browser never has them, so
* none of this reaches it. Loaded after index.css (main.tsx).
*/
/* Inside the iOS and Android app (native/nativeApp.ts sets the attribute): a long
press on a label, card or image does nothing, as in a native app, instead of
starting a text selection, a magnifier or a "save image" callout. What the user
types into stays selectable, or editing, pasting and moving the caret would break;
text worth copying opts in with .trek-selectable. A browser keeps its default. */
html[data-native-app] body {
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
html[data-native-app] :is(input, textarea, select, [contenteditable]:not([contenteditable='false']), .trek-selectable),
html[data-native-app] :is([contenteditable]:not([contenteditable='false']), .trek-selectable) * {
-webkit-user-select: text;
user-select: text;
-webkit-touch-callout: default;
}
html[data-native-app] img {
-webkit-user-drag: none;
}
/* A picture still loading waits unseen and fades in once it is there
(native/imageFade.ts). An animation rather than a transition, so an image's
own transitions (a hover zoom, a crossfade) stay as they are. */
html[data-native-app] img[data-fading] {
opacity: 0;
}
@keyframes trek-image-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@media (prefers-reduced-motion: no-preference) {
html[data-native-app]:not([data-reduce-motion]) img[data-faded] {
animation: trek-image-in 0.24s ease-out;
}
}
/* The press a native button shows the moment a finger lands on it. Most of the
UI says nothing until the finger lifts, which reads as lag. Only what has no
press of its own (no active: class), only the innermost pressed control, not
the card around a pressed button, and after a 60 ms wait, so a finger that
lands on a row to scroll the list does not flash it. Draggable rows show
their own pick-up; data-no-press opts a control out. */
html[data-native-app]
:is(button, a[href], [role='button'], [role='tab'], [role='menuitem'], [role='option'], summary):not(:disabled):not(
[aria-disabled='true']
):not([class*='active:']):not([draggable='true']):not([data-no-press]):not([data-pressing]):not(
:has(:is(button, a[href], [role='button']):active)
):active {
opacity: 0.55;
transition: opacity 0s linear 60ms;
}
/* A card held for its menu lifts a little under the finger
(mobile/components/useLongPress.ts), as a native context menu does. */
html[data-native-app] [data-long-press] {
transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
html[data-native-app] [data-long-press][data-pressing] {
transform: scale(0.97);
}
/* A tap focuses a button on Android, and a focus: ring (rather than
focus-visible:) then stays round it, which no native control shows. Focus
from a hardware keyboard is focus-visible and keeps its ring. */
html[data-touch-input]
:is(button, a, [role='button'], [role='tab'], [role='menuitem'], [role='option'], [tabindex]):focus:not(
:focus-visible
) {
outline: none;
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
}
/* The handover from the app's address screen to this server's UI
(native/appBoot.ts): the waiting states stand on that screen's colour, with
its spinner, which fades in only once the wait is long enough to notice. */
html[data-app-boot] .app-boot {
position: fixed;
inset: 0;
display: grid;
place-items: center;
background: #fffaf5;
}
html[data-app-boot] .app-boot span {
width: 24px;
height: 24px;
border-radius: 50%;
border: 2.5px solid #6b5f57;
border-top-color: transparent;
animation:
trek-boot-spin 0.8s linear infinite,
trek-image-in 0.3s ease-out 0.6s both;
}
@keyframes trek-boot-spin {
to {
transform: rotate(360deg);
}
}
/* Signed in from the app's sign-in screen: the app rises in on the page
colour instead of cutting in (native/appBoot.ts endAppBoot). */
html[data-app-enter] #root {
animation: trek-app-enter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes trek-app-enter {
from {
opacity: 0;
transform: scale(0.97);
}
to {
opacity: 1;
transform: none;
}
}
@media (prefers-reduced-motion: reduce) {
html[data-app-enter] #root {
animation-duration: 0.01s;
}
}