fix install commands (#57)

* fix install commands

* allow disabling animated man

* chore: auto-fix linting and formatting issues

---------

Co-authored-by: uubulb <uubulb@users.noreply.github.com>
This commit is contained in:
UUBulb
2024-12-15 19:38:35 +08:00
committed by GitHub
parent 271bdb7f50
commit 3ec7e7a784
4 changed files with 36 additions and 31 deletions

View File

@@ -64,14 +64,19 @@ export default function Header() {
const navigate = useNavigate() const navigate = useNavigate()
// @ts-expect-error DisableAnimatedMan is a global variable
const disableAnimatedMan = window.DisableAnimatedMan === true
return isDesktop ? ( return isDesktop ? (
<header className="flex pt-8 px-4 dark:bg-black/40 bg-muted border-b-[1px] overflow-visible"> <header className="flex pt-8 px-4 dark:bg-black/40 bg-muted border-b-[1px] overflow-visible">
<NavigationMenu className="flex flex-col items-start relative max-w-5xl mx-auto"> <NavigationMenu className="flex flex-col items-start relative max-w-5xl mx-auto">
<img {!disableAnimatedMan && (
className="absolute -right-0 z-[9999] top-11 w-20 scale-100 pointer-events-none" <img
alt={"animated-man"} className="absolute -right-0 z-[9999] top-11 w-20 scale-100 pointer-events-none"
src={"/dashboard/animated-man.webp"} alt={"animated-man"}
/> src={"/dashboard/animated-man.webp"}
/>
)}
<section className="w-full flex items-center justify-between"> <section className="w-full flex items-center justify-between">
<div className="flex justify-between items-center w-full"> <div className="flex justify-between items-center w-full">
<NavigationMenuLink <NavigationMenuLink
@@ -339,7 +344,7 @@ export default function Header() {
// https://github.com/streamich/react-use/blob/master/src/useInterval.ts // https://github.com/streamich/react-use/blob/master/src/useInterval.ts
const useInterval = (callback: () => void, delay?: number | null) => { const useInterval = (callback: () => void, delay?: number | null) => {
const savedCallback = useRef<() => void>(() => { }) const savedCallback = useRef<() => void>(() => {})
useEffect(() => { useEffect(() => {
savedCallback.current = callback savedCallback.current = callback
}) })

View File

@@ -29,8 +29,8 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
if (!copy) { if (!copy) {
try { try {
setCopy(true) setCopy(true)
if (!settings) throw new Error("Settings is not found.") if (!settings.data) throw new Error("Settings is not found.")
await copyToClipboard(generateCommand(type, settings) || "") await copyToClipboard(generateCommand(type, settings.data) || "")
} catch (e: Error | any) { } catch (e: Error | any) {
console.error(e) console.error(e)
toast(t("Error"), { toast(t("Error"), {

View File

@@ -42,7 +42,7 @@ export default function Root() {
Array.from(tempDiv.childNodes).forEach((node) => { Array.from(tempDiv.childNodes).forEach((node) => {
if (node.nodeType === Node.ELEMENT_NODE) { if (node.nodeType === Node.ELEMENT_NODE) {
const element = node as HTMLElement const element = node as HTMLElement
; (handlers[element.tagName] || handlers.DEFAULT)(element) ;(handlers[element.tagName] || handlers.DEFAULT)(element)
} else if (node.nodeType === Node.TEXT_NODE) { } else if (node.nodeType === Node.TEXT_NODE) {
document.body.appendChild(document.createTextNode(node.textContent || "")) document.body.appendChild(document.createTextNode(node.textContent || ""))
} }

View File

@@ -57,21 +57,21 @@ export default function SettingsPage() {
resolver: zodResolver(settingFormSchema), resolver: zodResolver(settingFormSchema),
defaultValues: config defaultValues: config
? { ? {
...config, ...config,
language: config.language, language: config.language,
site_name: config.site_name || "", site_name: config.site_name || "",
user_template: user_template:
config.user_template || config.user_template ||
Object.keys(config.frontend_templates.filter((t) => !t.is_admin) || {})[0] || Object.keys(config.frontend_templates.filter((t) => !t.is_admin) || {})[0] ||
"user-dist", "user-dist",
} }
: { : {
ip_change_notification_group_id: 0, ip_change_notification_group_id: 0,
cover: 1, cover: 1,
site_name: "", site_name: "",
language: "", language: "",
user_template: "user-dist", user_template: "user-dist",
}, },
resetOptions: { resetOptions: {
keepDefaultValues: false, keepDefaultValues: false,
}, },
@@ -219,15 +219,15 @@ export default function SettingsPage() {
{!config?.frontend_templates?.find( {!config?.frontend_templates?.find(
(t) => t.path === field.value, (t) => t.path === field.value,
)?.is_official && ( )?.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="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"> <div className="font-medium text-lg mb-1">
{t("CommunityThemeWarning")} {t("CommunityThemeWarning")}
</div>
<div className="text-yellow-700 dark:text-yellow-200">
{t("CommunityThemeDescription")}
</div>
</div> </div>
)} <div className="text-yellow-700 dark:text-yellow-200">
{t("CommunityThemeDescription")}
</div>
</div>
)}
</FormItem> </FormItem>
)} )}
/> />