mishig HF Staff commited on
Commit
633c0de
Β·
verified Β·
1 Parent(s): 74a60a9

Sync from GitHub via hub-sync

Browse files
src/app/[org]/[dataset]/[episode]/episode-viewer.tsx CHANGED
@@ -531,7 +531,7 @@ function EpisodeViewerInner({
531
  label="Doctor"
532
  title="Dataset quality diagnostics (powered by lerobot-doctor)"
533
  />
534
- <div className="ml-auto pr-3">
535
  <HfAuthButton variant="tab" />
536
  </div>
537
  </div>
 
531
  label="Doctor"
532
  title="Dataset quality diagnostics (powered by lerobot-doctor)"
533
  />
534
+ <div className="ml-auto">
535
  <HfAuthButton variant="tab" />
536
  </div>
537
  </div>
src/components/hf-auth-button.tsx CHANGED
@@ -16,6 +16,18 @@ const SIGNIN_BADGE_URL =
16
  // of the same register.
17
  type Variant = "badge" | "ghost" | "tab";
18
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  interface HfAuthButtonProps {
20
  variant?: Variant;
21
  }
@@ -26,11 +38,11 @@ export default function HfAuthButton({ variant = "badge" }: HfAuthButtonProps) {
26
  // Stable slot β€” auth state resolves async on mount (config fetch, then
27
  // localStorage rehydrate), so the rendered control changes from
28
  // null β†’ signed-out β†’ signed-in. Reserve the height so the surrounding
29
- // layout doesn't reflow each time. h-6 matches the badge image's
30
- // intrinsic height and is also tall enough to contain the ghost/tab/pill
31
- // variants without clipping.
32
  if (!isAuthAvailable) {
33
- return <span aria-hidden className="inline-block h-6" />;
 
 
34
  }
35
 
36
  if (oauth) {
@@ -61,7 +73,7 @@ export default function HfAuthButton({ variant = "badge" }: HfAuthButtonProps) {
61
  <button
62
  onClick={signIn}
63
  title="Sign in to access your private datasets"
64
- className="cursor-pointer inline-flex items-center h-6 gap-1.5 px-3 text-[11px] font-medium tracking-wide uppercase text-slate-400 hover:text-cyan-300 transition-colors rounded focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-400/60"
65
  >
66
  <span aria-hidden>πŸ€—</span>
67
  <span>Sign in</span>
 
16
  // of the same register.
17
  type Variant = "badge" | "ghost" | "tab";
18
 
19
+ // Slot height per variant. Matches the variant's rendered button so the
20
+ // pre-config placeholder (when isAuthAvailable hasn't resolved yet) and the
21
+ // signed-in/signed-out states all occupy exactly the same vertical space β€”
22
+ // no layout shift on auth state changes. `tab` is taller because it lives
23
+ // in the episode tab bar and needs to align with the `text-xs px-5 py-3`
24
+ // tab buttons (~40px implicit height).
25
+ const SLOT_HEIGHT: Record<Variant, string> = {
26
+ badge: "h-6",
27
+ ghost: "h-6",
28
+ tab: "h-10",
29
+ };
30
+
31
  interface HfAuthButtonProps {
32
  variant?: Variant;
33
  }
 
38
  // Stable slot β€” auth state resolves async on mount (config fetch, then
39
  // localStorage rehydrate), so the rendered control changes from
40
  // null β†’ signed-out β†’ signed-in. Reserve the height so the surrounding
41
+ // layout doesn't reflow each time.
 
 
42
  if (!isAuthAvailable) {
43
+ return (
44
+ <span aria-hidden className={`inline-block ${SLOT_HEIGHT[variant]}`} />
45
+ );
46
  }
47
 
48
  if (oauth) {
 
73
  <button
74
  onClick={signIn}
75
  title="Sign in to access your private datasets"
76
+ className="cursor-pointer inline-flex items-center h-10 gap-1.5 px-5 text-[11px] font-medium tracking-wide uppercase text-slate-400 hover:text-cyan-300 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-400/60"
77
  >
78
  <span aria-hidden>πŸ€—</span>
79
  <span>Sign in</span>