fix: correct 'Manage API Keys' link from /pair success screen
- Profile page now reads ?tab= query param to open Settings tab directly - Settings container reads ?subtab= query param to open API Keys directly - /pair success link updated to /profile?tab=settings&subtab=api-keys (was /profile/settings?tab=api-keys which 404'd)
This commit is contained in:
@@ -170,7 +170,7 @@ function PairContent() {
|
|||||||
was created. You can close this page and return to your Steam Deck.
|
was created. You can close this page and return to your Steam Deck.
|
||||||
</p>
|
</p>
|
||||||
<Link
|
<Link
|
||||||
href="/profile/settings?tab=api-keys"
|
href="/profile?tab=settings&subtab=api-keys"
|
||||||
className="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-white text-sm font-medium hover:bg-primary/90 transition-colors"
|
className="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-white text-sm font-medium hover:bg-primary/90 transition-colors"
|
||||||
>
|
>
|
||||||
Manage API Keys
|
Manage API Keys
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ type Tab = "overview" | "saved" | "settings"
|
|||||||
export default function ProfilePage() {
|
export default function ProfilePage() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { data: session, isPending: isSessionLoading } = useSession()
|
const { data: session, isPending: isSessionLoading } = useSession()
|
||||||
const [activeTab, setActiveTab] = useState<Tab>("overview")
|
const [activeTab, setActiveTab] = useState<Tab>(() => {
|
||||||
|
if (typeof window === "undefined") return "overview"
|
||||||
|
const params = new URLSearchParams(window.location.search)
|
||||||
|
const t = params.get("tab")
|
||||||
|
return t === "settings" || t === "saved" ? (t as Tab) : "overview"
|
||||||
|
})
|
||||||
const [profile, setProfile] = useState<{
|
const [profile, setProfile] = useState<{
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useState, useEffect } from "react"
|
import { useState, useEffect } from "react"
|
||||||
|
import { useSearchParams } from "next/navigation"
|
||||||
import { User, Shield, Link as LinkIcon, Key } from "lucide-react"
|
import { User, Shield, Link as LinkIcon, Key } from "lucide-react"
|
||||||
import { SettingsProfileTab } from "@/components/profile/settings-profile-tab"
|
import { SettingsProfileTab } from "@/components/profile/settings-profile-tab"
|
||||||
import { SettingsSecurityTab } from "@/components/profile/settings-security-tab"
|
import { SettingsSecurityTab } from "@/components/profile/settings-security-tab"
|
||||||
@@ -16,6 +17,8 @@ interface AuthMethods {
|
|||||||
|
|
||||||
type SettingsSubTab = "profile" | "security" | "accounts" | "api-keys"
|
type SettingsSubTab = "profile" | "security" | "accounts" | "api-keys"
|
||||||
|
|
||||||
|
const VALID_SUBTABS: SettingsSubTab[] = ["profile", "security", "accounts", "api-keys"]
|
||||||
|
|
||||||
const subTabs: { id: SettingsSubTab; label: string; icon: typeof User }[] = [
|
const subTabs: { id: SettingsSubTab; label: string; icon: typeof User }[] = [
|
||||||
{ id: "profile", label: "Profile", icon: User },
|
{ id: "profile", label: "Profile", icon: User },
|
||||||
{ id: "security", label: "Security", icon: Shield },
|
{ id: "security", label: "Security", icon: Shield },
|
||||||
@@ -42,7 +45,12 @@ export function SettingsContainer({
|
|||||||
userId,
|
userId,
|
||||||
onImageChange,
|
onImageChange,
|
||||||
}: SettingsContainerProps) {
|
}: SettingsContainerProps) {
|
||||||
const [activeSubTab, setActiveSubTab] = useState<SettingsSubTab>("profile")
|
const [activeSubTab, setActiveSubTab] = useState<SettingsSubTab>(() => {
|
||||||
|
if (typeof window === "undefined") return "profile"
|
||||||
|
const params = new URLSearchParams(window.location.search)
|
||||||
|
const sub = params.get("subtab")
|
||||||
|
return sub && VALID_SUBTABS.includes(sub as SettingsSubTab) ? (sub as SettingsSubTab) : "profile"
|
||||||
|
})
|
||||||
const [authMethods, setAuthMethods] = useState<AuthMethods | null>(null)
|
const [authMethods, setAuthMethods] = useState<AuthMethods | null>(null)
|
||||||
const [isLoadingAuthMethods, setIsLoadingAuthMethods] = useState(true)
|
const [isLoadingAuthMethods, setIsLoadingAuthMethods] = useState(true)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user