Repository navigation
fix(gui): match the Getting started startup step to OpenCodex Desktop #8476
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
167dc59
fix(gui): match the Getting started startup step to OpenCodex Desktop
lidge-jun a52b90d
docs(devlog): record desktop checklist evidence
lidge-jun d9b5672
fix(gui): align the German menu term and document every Desktop check…
lidge-jun 1df9b10
Merge remote-tracking branch 'origin/dev' into fix/desktop-autostart-…
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
devlog/_plan/261110_desktop_autostart_checklist/000_plan.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { useEffect, useRef, useState } from "react"; | ||
| import { canonicalHashPath } from "../app-routing"; | ||
|
|
||
| /** Getting started links here when OpenCodex Desktop keeps the proxy running. */ | ||
| export const STARTUP_DESKTOP_HASH = "startup/desktop"; | ||
|
|
||
| function atDesktopHash(): boolean { | ||
| return typeof window !== "undefined" && canonicalHashPath(window.location.hash) === STARTUP_DESKTOP_HASH; | ||
| } | ||
|
|
||
| /** | ||
| * Bring the Desktop card into view each time the page is reached through `#startup/desktop`. | ||
| * | ||
| * App mounts Startup without the sub-path, and navigating within the page changes only the hash, | ||
| * so arrivals are counted from `hashchange`. Each arrival is spent once, after the card renders, | ||
| * so later polls and stale refreshes never move focus. No card means nothing happens, and the | ||
| * hash is left as it is. | ||
| */ | ||
| export function useStartupDesktopFocus(cardRendered: boolean): void { | ||
| const [arrival, setArrival] = useState(() => (atDesktopHash() ? 1 : 0)); | ||
| const handled = useRef(0); | ||
|
|
||
| useEffect(() => { | ||
| const onHash = () => { if (atDesktopHash()) setArrival(count => count + 1); }; | ||
| window.addEventListener("hashchange", onHash); | ||
| return () => window.removeEventListener("hashchange", onHash); | ||
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| if (arrival === 0 || handled.current === arrival || !cardRendered) return; | ||
| const card = document.querySelector<HTMLElement>('[data-option="desktop"]'); | ||
| if (!card) return; | ||
| handled.current = arrival; | ||
| const reduceMotion = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches; | ||
| card.scrollIntoView?.({ behavior: reduceMotion ? "auto" : "smooth", block: "start" }); | ||
| if (!card.hasAttribute("tabindex")) card.tabIndex = -1; | ||
| card.focus({ preventScroll: true }); | ||
| }, [arrival, cardRendered]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.