mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-09-12 19:58:21 +02:00
Prettier 2: Electric Boogaloo (#6113)
# Description of Changes When I added Prettier formatting in #6052, my aim was to use just the default settings in Prettier. Turns out, Prettier looks _really hard_ for any config files if it's not explicitly given one, which means that if a developer has some sort of Prettier config file lying around on their system, Prettier might find it and use it. Also, Prettier changes its defaults based on stuff in `.editorconfig` without any good way of disabling that behaviour explicitly in its config file. To solve both of these issues, I've introduced a `.prettierrc` file which sets Prettier's defaults explicitly, and then reformatted all our code _again_ in Prettier's actual default settings. This should achieve the aim of #6052 and remove the possibility for it breaking on different dev computers.
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { Box, Tooltip, rem, useComputedColorScheme } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connectionModeService, type ConnectionMode } from "@app/services/connectionModeService";
|
||||
import { selfHostedServerMonitor, type SelfHostedServerState } from "@app/services/selfHostedServerMonitor";
|
||||
import {
|
||||
connectionModeService,
|
||||
type ConnectionMode,
|
||||
} from "@app/services/connectionModeService";
|
||||
import {
|
||||
selfHostedServerMonitor,
|
||||
type SelfHostedServerState,
|
||||
} from "@app/services/selfHostedServerMonitor";
|
||||
import { useBackendHealth } from "@app/hooks/useBackendHealth";
|
||||
import { OPEN_SIGN_IN_EVENT } from "@app/constants/signInEvents";
|
||||
|
||||
@@ -13,15 +19,21 @@ interface RightRailFooterExtensionsProps {
|
||||
function ConnectionStatusDot() {
|
||||
const { t } = useTranslation();
|
||||
const colorScheme = useComputedColorScheme("light");
|
||||
const [connectionMode, setConnectionMode] = useState<ConnectionMode | null>(null);
|
||||
const [selfHostedState, setSelfHostedState] = useState<SelfHostedServerState>(() => selfHostedServerMonitor.getSnapshot());
|
||||
const [connectionMode, setConnectionMode] = useState<ConnectionMode | null>(
|
||||
null,
|
||||
);
|
||||
const [selfHostedState, setSelfHostedState] = useState<SelfHostedServerState>(
|
||||
() => selfHostedServerMonitor.getSnapshot(),
|
||||
);
|
||||
const { isOnline, checkHealth } = useBackendHealth();
|
||||
|
||||
useEffect(() => {
|
||||
void connectionModeService.getCurrentMode().then(setConnectionMode);
|
||||
const unsubscribe = connectionModeService.subscribeToModeChanges((config) => {
|
||||
setConnectionMode(config.mode);
|
||||
});
|
||||
const unsubscribe = connectionModeService.subscribeToModeChanges(
|
||||
(config) => {
|
||||
setConnectionMode(config.mode);
|
||||
},
|
||||
);
|
||||
return unsubscribe;
|
||||
}, []);
|
||||
|
||||
@@ -40,13 +52,26 @@ function ConnectionStatusDot() {
|
||||
const serverOnline = selfHostedState.isOnline;
|
||||
const serverChecking = selfHostedState.status === "checking";
|
||||
const backendLabel = serverChecking
|
||||
? t("connectionMode.status.selfhostedChecking", "Connected to self-hosted server (checking...)")
|
||||
? t(
|
||||
"connectionMode.status.selfhostedChecking",
|
||||
"Connected to self-hosted server (checking...)",
|
||||
)
|
||||
: serverOnline
|
||||
? t("connectionMode.status.selfhostedOnline", "Connected to self-hosted server")
|
||||
: t("connectionMode.status.selfhostedOffline", "Self-hosted server unreachable");
|
||||
? t(
|
||||
"connectionMode.status.selfhostedOnline",
|
||||
"Connected to self-hosted server",
|
||||
)
|
||||
: t(
|
||||
"connectionMode.status.selfhostedOffline",
|
||||
"Self-hosted server unreachable",
|
||||
);
|
||||
return {
|
||||
label: backendLabel,
|
||||
color: serverChecking ? "#fcc419" : serverOnline ? "#37b24d" : "#e03131",
|
||||
color: serverChecking
|
||||
? "#fcc419"
|
||||
: serverOnline
|
||||
? "#37b24d"
|
||||
: "#e03131",
|
||||
};
|
||||
}
|
||||
// local
|
||||
@@ -84,7 +109,10 @@ function ConnectionStatusDot() {
|
||||
height: rem(10),
|
||||
borderRadius: "50%",
|
||||
backgroundColor: color,
|
||||
boxShadow: colorScheme === "dark" ? "0 0 0 2px rgba(255, 255, 255, 0.15)" : "0 0 0 2px rgba(0, 0, 0, 0.07)",
|
||||
boxShadow:
|
||||
colorScheme === "dark"
|
||||
? "0 0 0 2px rgba(255, 255, 255, 0.15)"
|
||||
: "0 0 0 2px rgba(0, 0, 0, 0.07)",
|
||||
display: "inline-block",
|
||||
cursor: "pointer",
|
||||
outline: "none",
|
||||
@@ -94,7 +122,9 @@ function ConnectionStatusDot() {
|
||||
);
|
||||
}
|
||||
|
||||
export function RightRailFooterExtensions({ className }: RightRailFooterExtensionsProps) {
|
||||
export function RightRailFooterExtensions({
|
||||
className,
|
||||
}: RightRailFooterExtensionsProps) {
|
||||
return (
|
||||
<Box
|
||||
className={className}
|
||||
|
||||
Reference in New Issue
Block a user