mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 21:19:52 +01:00
feat: upgrade rest of them
This commit is contained in:
1 parent
fe4afdcbf0
commit
30e87743fc
63 files changed
+824
-1123
No files matched your search
@@ -6,17 +6,16 @@ import {
|
||||
Text,
|
||||
TextField,
|
||||
Tooltip,
|
||||
} from '@radix-ui/themes';
|
||||
import { useRef, useState } from 'react';
|
||||
import { parse } from 'urlon';
|
||||
import { useLocale } from '../../hooks/useLocale';
|
||||
import { EmbedState } from '../../stores/embedState';
|
||||
} from "@radix-ui/themes";
|
||||
import { useRef, useState } from "react";
|
||||
import { parse } from "urlon";
|
||||
import { useLocale } from "../../hooks/useLocale";
|
||||
import { EmbedState } from "../../stores/embedState";
|
||||
|
||||
export function Import() {
|
||||
const importInput = useRef<HTMLInputElement>(null);
|
||||
const [showInvalidURLPrompt, setShowInvalidURLPrompt] = useState(false);
|
||||
const [showConfirmation, setConfirmation] = useState(false);
|
||||
const mutateEmbedState = EmbedState.useMutation();
|
||||
const { strings } = useLocale();
|
||||
|
||||
return (
|
||||
@@ -64,15 +63,15 @@ export function Import() {
|
||||
|
||||
try {
|
||||
const url = new URL(importInput.current.value);
|
||||
const state = url.searchParams.get('state');
|
||||
const state = url.searchParams.get("state");
|
||||
if (state === null) throw undefined;
|
||||
const json = parse(state);
|
||||
|
||||
mutateEmbedState((draft) => {
|
||||
EmbedState.mutate((draft) => {
|
||||
Object.assign(draft, json);
|
||||
});
|
||||
|
||||
importInput.current.value = '';
|
||||
importInput.current.value = "";
|
||||
setConfirmation(true);
|
||||
setTimeout(() => setConfirmation(false), 2000);
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user