forked from TGlide/movie-web
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
theme system + device list + device logout + delete account + registe…
…r callout + split up settings page components
- Loading branch information
Showing
28 changed files
with
945 additions
and
448 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,32 @@ | ||
import { ofetch } from "ofetch"; | ||
|
||
import { getAuthHeaders } from "@/backend/accounts/auth"; | ||
import { AccountWithToken } from "@/stores/auth"; | ||
|
||
export interface SessionResponse { | ||
id: string; | ||
userId: string; | ||
createdAt: string; | ||
accessedAt: string; | ||
device: string; | ||
userAgent: string; | ||
} | ||
|
||
export async function getSessions(url: string, account: AccountWithToken) { | ||
return ofetch<SessionResponse[]>(`/users/${account.userId}/sessions`, { | ||
headers: getAuthHeaders(account.token), | ||
baseURL: url, | ||
}); | ||
} | ||
|
||
export async function removeSession( | ||
url: string, | ||
token: string, | ||
sessionId: string | ||
) { | ||
return ofetch<SessionResponse[]>(`/sessions/${sessionId}`, { | ||
method: "DELETE", | ||
headers: getAuthHeaders(token), | ||
baseURL: url, | ||
}); | ||
} |
This file contains 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 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,37 @@ | ||
import classNames from "classnames"; | ||
|
||
export function SettingsCard(props: { | ||
children: React.ReactNode; | ||
className?: string; | ||
paddingClass?: string; | ||
}) { | ||
return ( | ||
<div | ||
className={classNames( | ||
"w-full rounded-lg bg-settings-card-background bg-opacity-[0.15] border border-settings-card-border", | ||
props.paddingClass ?? "px-8 py-6", | ||
props.className | ||
)} | ||
> | ||
{props.children} | ||
</div> | ||
); | ||
} | ||
|
||
export function SolidSettingsCard(props: { | ||
children: React.ReactNode; | ||
className?: string; | ||
paddingClass?: string; | ||
}) { | ||
return ( | ||
<div | ||
className={classNames( | ||
"w-full rounded-lg bg-settings-card-altBackground bg-opacity-50", | ||
props.paddingClass ?? "px-8 py-6", | ||
props.className | ||
)} | ||
> | ||
{props.children} | ||
</div> | ||
); | ||
} |
This file contains 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,45 @@ | ||
import classNames from "classnames"; | ||
|
||
import { Icon, Icons } from "@/components/Icon"; | ||
|
||
export function SidebarSection(props: { | ||
title: string; | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<section> | ||
<p className="text-sm font-bold uppercase text-settings-sidebar-type-secondary mb-2"> | ||
{props.title} | ||
</p> | ||
{props.children} | ||
</section> | ||
); | ||
} | ||
|
||
export function SidebarLink(props: { | ||
children: React.ReactNode; | ||
icon: Icons; | ||
active?: boolean; | ||
onClick?: () => void; | ||
}) { | ||
return ( | ||
<div | ||
onClick={props.onClick} | ||
className={classNames( | ||
"w-full px-3 py-2 flex items-center space-x-3 cursor-pointer rounded my-2", | ||
props.active | ||
? "bg-settings-sidebar-activeLink text-settings-sidebar-type-activated" | ||
: null | ||
)} | ||
> | ||
<Icon | ||
className={classNames( | ||
"text-2xl text-settings-sidebar-type-icon", | ||
props.active ? "text-settings-sidebar-type-iconActivated" : null | ||
)} | ||
icon={props.icon} | ||
/> | ||
<span>{props.children}</span> | ||
</div> | ||
); | ||
} |
This file contains 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,3 @@ | ||
export function SecondaryLabel(props: { children: React.ReactNode }) { | ||
return <p className="text-type-text">{props.children}</p>; | ||
} |
This file contains 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 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.