-
-
Notifications
You must be signed in to change notification settings - Fork 80
[Feature]: Switch to TS 7. #382
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
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| "use client" | ||
|
|
||
| import { useState } from "react" | ||
| import { ScreenShare, ShieldAlert } from "lucide-react" | ||
| import { t } from "../../utils/i18n" | ||
|
|
||
| interface ScreenShareConsentProps { | ||
| onAllow: () => void | ||
| } | ||
|
|
||
| export const ScreenShareConsent = ({ onAllow }: ScreenShareConsentProps) => { | ||
| const [denied, setDenied] = useState(false) | ||
|
|
||
| return ( | ||
| <div className="absolute inset-0 flex items-center justify-center bg-black overflow-hidden select-none touch-none"> | ||
| <div className="w-full h-full place-content-center p-6 bg-base-300 shadow-2xl flex flex-col items-center text-center gap-6 duration-300"> | ||
| <div className="relative flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary"> | ||
| {denied ? ( | ||
| <ShieldAlert className="w-8 h-8" /> | ||
| ) : ( | ||
| <ScreenShare className="w-8 h-8" /> | ||
| )} | ||
| </div> | ||
|
|
||
| <div className="space-y-2"> | ||
| <h3 className="text-xl font-bold text-base-content"> | ||
| {denied | ||
| ? t("screenShareConsent", "deniedTitle") | ||
| : t("screenShareConsent", "title")} | ||
| </h3> | ||
| <p className="text-sm text-base-content/70 max-w-sm px-2"> | ||
| {denied | ||
| ? t("screenShareConsent", "deniedDescription") | ||
| : t("screenShareConsent", "description")} | ||
| </p> | ||
| </div> | ||
| <div className="divider my-0 opacity-40" /> | ||
| <div className="space-y-3 w-full max-w-xs"> | ||
| <button | ||
| type="button" | ||
| onClick={onAllow} | ||
| className="btn btn-block btn-primary gap-2 shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all duration-200" | ||
| > | ||
| <ScreenShare className="w-4 h-4" /> | ||
| {denied | ||
| ? t("screenShareConsent", "tryAgain") | ||
| : t("screenShareConsent", "allow")} | ||
| </button> | ||
| {!denied && ( | ||
| <button | ||
| type="button" | ||
| onClick={() => setDenied(true)} | ||
| className="btn btn-block btn-ghost" | ||
| > | ||
| {t("screenShareConsent", "deny")} | ||
| </button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import { useRemoteConnection } from "../hooks/useRemoteConnection" | |
| import { useTrackpadGesture } from "../hooks/useTrackpadGesture" | ||
| import { ScreenMirror } from "../components/Trackpad/ScreenMirror" | ||
| import { ErrorComponent } from "../components/Trackpad/ErrorComponent" | ||
| import { ScreenShareConsent } from "../components/Trackpad/ScreenShareConsent" | ||
|
Contributor
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. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Add the client-component directive.
As per path instructions, ensure that 🤖 Prompt for AI AgentsSource: Path instructions |
||
| import { useWebRtcStream } from "../hooks/useWebRtcStream" | ||
|
|
||
| export const Route = createFileRoute("/trackpad")({ | ||
|
|
@@ -42,7 +43,12 @@ function TrackpadPage() { | |
| const isComposingRef = useRef(false) | ||
| const [keyboardOpen, setKeyboardOpen] = useState(false) | ||
| const [extraKeysVisible, setExtraKeysVisible] = useState(true) | ||
| const [screenShareConsented, setScreenShareConsented] = useState(false) | ||
| const { status, send, sendCombo } = useRemoteConnection() | ||
| const { trackActive, videoStream, error, errorHandle, reconnect } = | ||
| useWebRtcStream({ | ||
| token: screenShareConsented ? token : null, | ||
| }) | ||
|
Comment on lines
+46
to
+51
|
||
| const { | ||
| trackActive, | ||
| videoStream, | ||
|
|
@@ -217,7 +223,9 @@ function TrackpadPage() { | |
| scrollMode={scrollMode} | ||
| handlers={handlers} | ||
| /> | ||
| {error && errorHandle ? ( | ||
| {!screenShareConsented ? ( | ||
| <ScreenShareConsent onAllow={() => setScreenShareConsented(true)} /> | ||
| ) : error && errorHandle ? ( | ||
| <ErrorComponent | ||
| error={error} | ||
| errorHandle={errorHandle} | ||
|
|
||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the consent dialog accessible.
The consent dialog has no
role="dialog",aria-modal, label association, or focus management. A keyboard or screen-reader user can continue into background controls instead of completing the consent action.Use an accessible modal primitive. Move focus to the allow button when the dialog opens. Keep focus inside the dialog. Restore focus when it closes. Associate the title and description with the dialog.
As per path instructions, the code must adhere to React and SPA best practices.
🤖 Prompt for AI Agents
Source: Path instructions