mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 07:55:25 +02:00
fix: Apply Prettier
This commit is contained in:
parent
491a6d82cc
commit
abfe85f363
@ -1,8 +1,6 @@
|
|||||||
import {client} from "~/constants/axios-client"
|
import {client} from "~/constants/axios-client"
|
||||||
|
|
||||||
export default async function checkIsDomainDisposable(
|
export default async function checkIsDomainDisposable(domain: string): Promise<boolean> {
|
||||||
domain: string,
|
|
||||||
): Promise<boolean> {
|
|
||||||
const {data} = await client.get(`https://api.mailcheck.ai/domain/${domain}`)
|
const {data} = await client.get(`https://api.mailcheck.ai/domain/${domain}`)
|
||||||
|
|
||||||
return !data.mx || data.disposable
|
return !data.mx || data.disposable
|
||||||
|
@ -2,10 +2,7 @@ import React, {ReactElement, useState} from "react"
|
|||||||
|
|
||||||
export interface FaviconImageProps
|
export interface FaviconImageProps
|
||||||
extends Omit<
|
extends Omit<
|
||||||
React.DetailedHTMLProps<
|
React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,
|
||||||
React.ImgHTMLAttributes<HTMLImageElement>,
|
|
||||||
HTMLImageElement
|
|
||||||
>,
|
|
||||||
"src"
|
"src"
|
||||||
> {
|
> {
|
||||||
url: string
|
url: string
|
||||||
@ -16,10 +13,7 @@ const getDomain = (url: string): string => {
|
|||||||
return `${hostname}${port ? `:${port}` : ""}`
|
return `${hostname}${port ? `:${port}` : ""}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FaviconImage({
|
export default function FaviconImage({url, ...props}: FaviconImageProps): ReactElement {
|
||||||
url,
|
|
||||||
...props
|
|
||||||
}: FaviconImageProps): ReactElement {
|
|
||||||
const [source, setSource] = useState<string>(`${url}/favicon.ico`)
|
const [source, setSource] = useState<string>(`${url}/favicon.ico`)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -27,11 +21,7 @@ export default function FaviconImage({
|
|||||||
{...props}
|
{...props}
|
||||||
src={source}
|
src={source}
|
||||||
onError={() =>
|
onError={() =>
|
||||||
setSource(
|
setSource(`https://external-content.duckduckgo.com/ip3/${getDomain(url)}.ico`)
|
||||||
`https://external-content.duckduckgo.com/ip3/${getDomain(
|
|
||||||
url,
|
|
||||||
)}.ico`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
@ -46,8 +46,7 @@ function MultiStepForm({
|
|||||||
}, [index, currentIndex])
|
}, [index, currentIndex])
|
||||||
|
|
||||||
const hasSize = Boolean(
|
const hasSize = Boolean(
|
||||||
(currentSize?.width || nextSize?.width) &&
|
(currentSize?.width || nextSize?.width) && (currentSize?.height || nextSize?.height),
|
||||||
(currentSize?.height || nextSize?.height),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -58,12 +57,8 @@ function MultiStepForm({
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
width:
|
width: Math.max(currentSize?.width || 0, nextSize?.width || 0) || "100%",
|
||||||
Math.max(currentSize?.width || 0, nextSize?.width || 0) ||
|
height: Math.max(currentSize?.height || 0, nextSize?.height || 0) || "100%",
|
||||||
"100%",
|
|
||||||
height:
|
|
||||||
Math.max(currentSize?.height || 0, nextSize?.height || 0) ||
|
|
||||||
"100%",
|
|
||||||
overflow: hasSize ? "hidden" : "visible",
|
overflow: hasSize ? "hidden" : "visible",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -73,13 +68,9 @@ function MultiStepForm({
|
|||||||
...currentSize,
|
...currentSize,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
transition: easing,
|
transition: easing,
|
||||||
transitionDuration: isTransitioning
|
transitionDuration: isTransitioning ? `${duration}ms` : "0ms",
|
||||||
? `${duration}ms`
|
|
||||||
: "0ms",
|
|
||||||
transformOrigin: isTransitioning
|
transformOrigin: isTransitioning
|
||||||
? `${nextSize?.x - currentSize.x}px ${
|
? `${nextSize?.x - currentSize.x}px ${nextSize?.y - currentSize.y}px`
|
||||||
nextSize?.y - currentSize.y
|
|
||||||
}px`
|
|
||||||
: "",
|
: "",
|
||||||
// Scale the difference between currentSize and nextSize
|
// Scale the difference between currentSize and nextSize
|
||||||
transform: isTransitioning
|
transform: isTransitioning
|
||||||
@ -102,12 +93,7 @@ function MultiStepForm({
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
$currentElement.current = ref
|
$currentElement.current = ref
|
||||||
|
|
||||||
const {
|
const {width = 0, height = 0, x, y} = ref.getBoundingClientRect()
|
||||||
width = 0,
|
|
||||||
height = 0,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
} = ref.getBoundingClientRect()
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
width !== 0 &&
|
width !== 0 &&
|
||||||
@ -152,16 +138,10 @@ function MultiStepForm({
|
|||||||
height: "max-content",
|
height: "max-content",
|
||||||
transition: easing,
|
transition: easing,
|
||||||
transitionDuration: isTransitioning ? `${duration}ms` : "",
|
transitionDuration: isTransitioning ? `${duration}ms` : "",
|
||||||
transform: isTransitioning
|
transform: isTransitioning ? "" : nextSize?.x ? "translateX(100%)" : "",
|
||||||
? ""
|
|
||||||
: nextSize?.x
|
|
||||||
? "translateX(100%)"
|
|
||||||
: "",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{currentIndex === steps.length - 1
|
{currentIndex === steps.length - 1 ? null : steps[currentIndex + 1]}
|
||||||
? null
|
|
||||||
: steps[currentIndex + 1]}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -6,9 +6,7 @@ export interface MultiStepFormElementProps {
|
|||||||
children: ReactElement
|
children: ReactElement
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MultiStepFormElement({
|
export default function MultiStepFormElement({children}: MultiStepFormElementProps): ReactElement {
|
||||||
children,
|
|
||||||
}: MultiStepFormElementProps): ReactElement {
|
|
||||||
return (
|
return (
|
||||||
<Box maxWidth="90vw" justifyContent="center" alignItems="center">
|
<Box maxWidth="90vw" justifyContent="center" alignItems="center">
|
||||||
<Container maxWidth="xs">{children}</Container>
|
<Container maxWidth="xs">{children}</Container>
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
import {MdVisibility, MdVisibilityOff} from "react-icons/md"
|
import {MdVisibility, MdVisibilityOff} from "react-icons/md"
|
||||||
import React, {ReactElement, useState} from "react"
|
import React, {ReactElement, useState} from "react"
|
||||||
|
|
||||||
import {
|
import {IconButton, InputAdornment, TextField, TextFieldProps} from "@mui/material"
|
||||||
IconButton,
|
|
||||||
InputAdornment,
|
|
||||||
TextField,
|
|
||||||
TextFieldProps,
|
|
||||||
} from "@mui/material"
|
|
||||||
|
|
||||||
export interface PasswordFieldProps extends Omit<TextFieldProps, "type"> {}
|
export interface PasswordFieldProps extends Omit<TextFieldProps, "type"> {}
|
||||||
|
|
||||||
@ -24,15 +19,8 @@ export default function PasswordField({
|
|||||||
...InputProps,
|
...InputProps,
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<IconButton
|
<IconButton edge="end" onClick={() => setShowPassword(value => !value)}>
|
||||||
edge="end"
|
{showPassword ? <MdVisibilityOff /> : <MdVisibility />}
|
||||||
onClick={() => setShowPassword(value => !value)}
|
|
||||||
>
|
|
||||||
{showPassword ? (
|
|
||||||
<MdVisibilityOff />
|
|
||||||
) : (
|
|
||||||
<MdVisibility />
|
|
||||||
)}
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
|
@ -28,12 +28,7 @@ export default function SimplePage({
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item width="100%">
|
<Grid item width="100%">
|
||||||
<Grid
|
<Grid container spacing={4} flexDirection="column" alignItems="stretch">
|
||||||
container
|
|
||||||
spacing={4}
|
|
||||||
flexDirection="column"
|
|
||||||
alignItems="stretch"
|
|
||||||
>
|
|
||||||
{subtitle && (
|
{subtitle && (
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography variant="h6" component="h2">
|
<Typography variant="h6" component="h2">
|
||||||
@ -48,9 +43,7 @@ export default function SimplePage({
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
{pageOptionsActions && (
|
{pageOptionsActions && <Grid item>{pageOptionsActions}</Grid>}
|
||||||
<Grid item>{pageOptionsActions}</Grid>
|
|
||||||
)}
|
|
||||||
<Grid item>{children}</Grid>
|
<Grid item>{children}</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -2,9 +2,7 @@ import {ReactElement} from "react"
|
|||||||
|
|
||||||
import {DecryptionPasswordMissingAlert} from "~/components"
|
import {DecryptionPasswordMissingAlert} from "~/components"
|
||||||
|
|
||||||
export default function WithEncryptionRequired(
|
export default function WithEncryptionRequired(Component: any): (props: any) => ReactElement {
|
||||||
Component: any,
|
|
||||||
): (props: any) => ReactElement {
|
|
||||||
return (props: any): ReactElement => {
|
return (props: any): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<DecryptionPasswordMissingAlert>
|
<DecryptionPasswordMissingAlert>
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import {useEffect, useState} from "react"
|
import {useEffect, useState} from "react"
|
||||||
|
|
||||||
export default function useIntervalUpdate(
|
export default function useIntervalUpdate(updateIntervalInMilliSeconds = 1000): [Date, () => void] {
|
||||||
updateIntervalInMilliSeconds = 1000,
|
|
||||||
): [Date, () => void] {
|
|
||||||
const [, setForceUpdateValue] = useState<number>(0)
|
const [, setForceUpdateValue] = useState<number>(0)
|
||||||
const [startDate, setStartDate] = useState(() => new Date())
|
const [startDate, setStartDate] = useState(() => new Date())
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import {Dispatch, SetStateAction, useState} from "react"
|
import {Dispatch, SetStateAction, useState} from "react"
|
||||||
import {useUpdateEffect} from "react-use"
|
import {useUpdateEffect} from "react-use"
|
||||||
|
|
||||||
export default function useUIState<T>(
|
export default function useUIState<T>(outerValue: T): [T, Dispatch<SetStateAction<T>>] {
|
||||||
outerValue: T,
|
|
||||||
): [T, Dispatch<SetStateAction<T>>] {
|
|
||||||
const [value, setValue] = useState<T>(outerValue)
|
const [value, setValue] = useState<T>(outerValue)
|
||||||
|
|
||||||
useUpdateEffect(() => {
|
useUpdateEffect(() => {
|
||||||
|
@ -3,6 +3,4 @@ import ReactDOM from "react-dom/client"
|
|||||||
|
|
||||||
import App from "~/App"
|
import App from "~/App"
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById("root") as HTMLDivElement).render(
|
ReactDOM.createRoot(document.getElementById("root") as HTMLDivElement).render(<App />)
|
||||||
<App />,
|
|
||||||
)
|
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
import {MdCheck} from "react-icons/md"
|
import {MdCheck} from "react-icons/md"
|
||||||
import {useSessionStorage} from "react-use"
|
import {useSessionStorage} from "react-use"
|
||||||
import React, {
|
import React, {ReactElement, useCallback, useEffect, useRef, useState} from "react"
|
||||||
ReactElement,
|
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from "react"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
@ -41,10 +35,7 @@ export default function DetectEmailAutofillService({
|
|||||||
const $hasDetected = useRef<boolean>(false)
|
const $hasDetected = useRef<boolean>(false)
|
||||||
|
|
||||||
const [type, setType] = useState<AliasType | null>(null)
|
const [type, setType] = useState<AliasType | null>(null)
|
||||||
const [hasShownModal, setHasShownModal] = useSessionStorage<boolean>(
|
const [hasShownModal, setHasShownModal] = useSessionStorage<boolean>(STORAGE_KEY, false)
|
||||||
STORAGE_KEY,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
|
|
||||||
const handleFound = useCallback(
|
const handleFound = useCallback(
|
||||||
(type: AliasType) => {
|
(type: AliasType) => {
|
||||||
@ -72,9 +63,7 @@ export default function DetectEmailAutofillService({
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const checkSimpleLogin = () => {
|
const checkSimpleLogin = () => {
|
||||||
const $element = document.querySelector(
|
const $element = document.querySelector("body > div.sl-button-wrapper")
|
||||||
"body > div.sl-button-wrapper",
|
|
||||||
)
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$element &&
|
$element &&
|
||||||
@ -116,17 +105,14 @@ export default function DetectEmailAutofillService({
|
|||||||
<Grid container spacing={2} justifyContent="center">
|
<Grid container spacing={2} justifyContent="center">
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<DialogContentText>
|
<DialogContentText>
|
||||||
We detected that you are using an email relay
|
We detected that you are using an email relay service to sign up. This
|
||||||
service to sign up. This KleckRelay instance does
|
KleckRelay instance does not support relaying to another email relay
|
||||||
not support relaying to another email relay service.
|
service. You can either choose a different instance or sign up with a
|
||||||
You can either choose a different instance or sign
|
different email address.
|
||||||
up with a different email address.
|
|
||||||
</DialogContentText>
|
</DialogContentText>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<DialogContentText>
|
<DialogContentText>Detected email relay:</DialogContentText>
|
||||||
Detected email relay:
|
|
||||||
</DialogContentText>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Alert severity="info">{TYPE_NAME_MAP[type!]}</Alert>
|
<Alert severity="info">{TYPE_NAME_MAP[type!]}</Alert>
|
||||||
@ -134,11 +120,7 @@ export default function DetectEmailAutofillService({
|
|||||||
</Grid>
|
</Grid>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button autoFocus startIcon={<MdCheck />} onClick={() => setType(null)}>
|
||||||
autoFocus
|
|
||||||
startIcon={<MdCheck />}
|
|
||||||
onClick={() => setType(null)}
|
|
||||||
>
|
|
||||||
Got it
|
Got it
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
@ -9,26 +9,15 @@ import YouGotMail from "~/route-widgets/SignupRoute/YouGotMail"
|
|||||||
|
|
||||||
export default function SignupRoute(): ReactElement {
|
export default function SignupRoute(): ReactElement {
|
||||||
const serverSettings = useLoaderData() as ServerSettings
|
const serverSettings = useLoaderData() as ServerSettings
|
||||||
const [email, setEmail] = useLocalStorage<string>(
|
const [email, setEmail] = useLocalStorage<string>("signup-form-state-email", "")
|
||||||
"signup-form-state-email",
|
|
||||||
"",
|
|
||||||
)
|
|
||||||
|
|
||||||
const index = email ? 1 : 0
|
const index = email ? 1 : 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiStepForm
|
<MultiStepForm
|
||||||
steps={[
|
steps={[
|
||||||
<EmailForm
|
<EmailForm serverSettings={serverSettings} onSignUp={setEmail} key="email" />,
|
||||||
serverSettings={serverSettings}
|
<YouGotMail onGoBack={() => setEmail("")} email={email || ""} key="you_got_mail" />,
|
||||||
onSignUp={setEmail}
|
|
||||||
key="email"
|
|
||||||
/>,
|
|
||||||
<YouGotMail
|
|
||||||
onGoBack={() => setEmail("")}
|
|
||||||
email={email || ""}
|
|
||||||
key="you_got_mail"
|
|
||||||
/>,
|
|
||||||
]}
|
]}
|
||||||
index={index}
|
index={index}
|
||||||
/>
|
/>
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import {KeyboardEventHandler} from "react"
|
import {KeyboardEventHandler} from "react"
|
||||||
|
|
||||||
export default function whenEnterPressed<T = HTMLDivElement>(
|
export default function whenEnterPressed<T = HTMLDivElement>(callback: KeyboardEventHandler<T>) {
|
||||||
callback: KeyboardEventHandler<T>,
|
|
||||||
) {
|
|
||||||
return (event: any) => {
|
return (event: any) => {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
callback(event)
|
callback(event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user