mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-05-06 05:38:51 +00:00
optimize fm (#82)
* optimize fm * chore: auto-fix linting and formatting issues * fix: type * chore: auto-fix linting and formatting issues --------- Co-authored-by: uubulb <uubulb@users.noreply.github.com> Co-authored-by: naiba <hi@nai.ba> Co-authored-by: naiba <naiba@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getOauth2RedirectURL, Oauth2RequestType } from "@/api/oauth2"
|
||||
import { Oauth2RequestType, getOauth2RedirectURL } from "@/api/oauth2"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
Form,
|
||||
@@ -59,7 +59,7 @@ function Login() {
|
||||
window.location.href = redirectUrl.redirect!
|
||||
} catch (error: any) {
|
||||
toast.error(error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { t } = useTranslation()
|
||||
@@ -103,9 +103,9 @@ function Login() {
|
||||
</form>
|
||||
</Form>
|
||||
<div className="mt-4">
|
||||
{settingData?.config?.oauth2_providers?.map((p: string) =>
|
||||
{settingData?.config?.oauth2_providers?.map((p: string) => (
|
||||
<Button onClick={() => loginWith(p)}>{p}</Button>
|
||||
)}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
+17
-8
@@ -1,4 +1,4 @@
|
||||
import { bindOauth2, getOauth2RedirectURL, Oauth2RequestType, unbindOauth2 } from "@/api/oauth2"
|
||||
import { Oauth2RequestType, bindOauth2, getOauth2RedirectURL, unbindOauth2 } from "@/api/oauth2"
|
||||
import { getProfile } from "@/api/user"
|
||||
import { ProfileCard } from "@/components/profile"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
@@ -31,7 +31,8 @@ export default function ProfilePage() {
|
||||
getProfile().then((profile) => {
|
||||
setProfile(profile)
|
||||
})
|
||||
}).finally(() => {
|
||||
})
|
||||
.finally(() => {
|
||||
window.history.replaceState({}, document.title, window.location.pathname)
|
||||
})
|
||||
}
|
||||
@@ -116,12 +117,20 @@ export default function ProfilePage() {
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="text-lg font-semibold">
|
||||
{settingData?.config?.oauth2_providers?.map((provider) => <div>
|
||||
{provider}: {profile.oauth2_bind?.[provider.toLowerCase()]} {profile.oauth2_bind?.[provider.toLowerCase()] ?
|
||||
<Button size="sm" onClick={() => unbindO2(provider)}>Unbind</Button>
|
||||
:
|
||||
<Button size="sm" onClick={() => bindO2(provider)}>Bind</Button>}
|
||||
</div>)}
|
||||
{settingData?.config?.oauth2_providers?.map((provider) => (
|
||||
<div>
|
||||
{provider}: {profile.oauth2_bind?.[provider.toLowerCase()]}{" "}
|
||||
{profile.oauth2_bind?.[provider.toLowerCase()] ? (
|
||||
<Button size="sm" onClick={() => unbindO2(provider)}>
|
||||
Unbind
|
||||
</Button>
|
||||
) : (
|
||||
<Button size="sm" onClick={() => bindO2(provider)}>
|
||||
Bind
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
+22
-22
@@ -67,21 +67,21 @@ export default function SettingsPage() {
|
||||
resolver: zodResolver(settingFormSchema),
|
||||
defaultValues: config
|
||||
? {
|
||||
...config,
|
||||
language: config?.config?.language,
|
||||
site_name: config.config?.site_name || "",
|
||||
user_template:
|
||||
config.config?.user_template ||
|
||||
Object.keys(config.frontend_templates?.filter((t) => !t.is_admin) || {})[0] ||
|
||||
"user-dist",
|
||||
}
|
||||
...config,
|
||||
language: config?.config?.language,
|
||||
site_name: config.config?.site_name || "",
|
||||
user_template:
|
||||
config.config?.user_template ||
|
||||
Object.keys(config.frontend_templates?.filter((t) => !t.is_admin) || {})[0] ||
|
||||
"user-dist",
|
||||
}
|
||||
: {
|
||||
ip_change_notification_group_id: 0,
|
||||
cover: 1,
|
||||
site_name: "",
|
||||
language: "",
|
||||
user_template: "user-dist",
|
||||
},
|
||||
ip_change_notification_group_id: 0,
|
||||
cover: 1,
|
||||
site_name: "",
|
||||
language: "",
|
||||
user_template: "user-dist",
|
||||
},
|
||||
resetOptions: {
|
||||
keepDefaultValues: false,
|
||||
},
|
||||
@@ -229,15 +229,15 @@ export default function SettingsPage() {
|
||||
{!config?.frontend_templates?.find(
|
||||
(t) => t.path === field.value,
|
||||
)?.is_official && (
|
||||
<div className="mt-2 text-sm text-yellow-700 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-900 border border-yellow-200 dark:border-yellow-700 rounded-md p-2">
|
||||
<div className="font-medium text-lg mb-1">
|
||||
{t("CommunityThemeWarning")}
|
||||
</div>
|
||||
<div className="text-yellow-700 dark:text-yellow-200">
|
||||
{t("CommunityThemeDescription")}
|
||||
</div>
|
||||
<div className="mt-2 text-sm text-yellow-700 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-900 border border-yellow-200 dark:border-yellow-700 rounded-md p-2">
|
||||
<div className="font-medium text-lg mb-1">
|
||||
{t("CommunityThemeWarning")}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-yellow-700 dark:text-yellow-200">
|
||||
{t("CommunityThemeDescription")}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user