mirror of
https://github.com/ritz078/transform.git
synced 2026-11-22 17:11:32 +03:00
upgrade dependencies (#184)
* upgrade dependencies * upgrade dependencies * format code * update nextjs * fixes * chore: update graphql generator * fixes * fixes * fixes
This commit is contained in:
1 parent
b69461b66e
commit
618bd8d5bc
88 files changed
+3427
-3350
No files matched your search
@@ -12,7 +12,7 @@ let prettierWorker;
|
||||
|
||||
function getEditorLanguage(lang: Language) {
|
||||
const mapping = {
|
||||
flow: "typescript"
|
||||
flow: "typescript",
|
||||
};
|
||||
|
||||
return mapping[lang] || lang;
|
||||
@@ -42,9 +42,7 @@ export interface ConversionPanelProps {
|
||||
settings?: any;
|
||||
}
|
||||
|
||||
const ConversionPanel: React.FunctionComponent<
|
||||
ConversionPanelProps
|
||||
> = function({
|
||||
const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function ({
|
||||
splitEditorProps,
|
||||
editorProps,
|
||||
resultEditorProps,
|
||||
@@ -59,7 +57,7 @@ const ConversionPanel: React.FunctionComponent<
|
||||
settings,
|
||||
editorDefaultValue,
|
||||
splitEditorDefaultValue,
|
||||
resultSettingsElement
|
||||
resultSettingsElement,
|
||||
}) {
|
||||
const [value, setValue] = useData(editorDefaultValue || editorLanguage);
|
||||
const [splitValue, setSplitValue] = useData(
|
||||
@@ -81,7 +79,7 @@ const ConversionPanel: React.FunctionComponent<
|
||||
packageName && packageUrl
|
||||
? {
|
||||
name: packageName,
|
||||
url: packageUrl
|
||||
url: packageUrl,
|
||||
}
|
||||
: undefined;
|
||||
}
|
||||
@@ -94,12 +92,12 @@ const ConversionPanel: React.FunctionComponent<
|
||||
|
||||
const result = await transformer({
|
||||
value,
|
||||
splitEditorValue: splitTitle ? splitValue : undefined
|
||||
splitEditorValue: splitTitle ? splitValue : undefined,
|
||||
});
|
||||
|
||||
const prettyResult = await prettierWorker.send({
|
||||
value: result,
|
||||
language: resultLanguage
|
||||
language: resultLanguage,
|
||||
});
|
||||
setResult(prettyResult);
|
||||
setMessage("");
|
||||
@@ -174,8 +172,8 @@ const ConversionPanel: React.FunctionComponent<
|
||||
<Spinner
|
||||
css={{
|
||||
"& circle": {
|
||||
stroke: "#0e7ccf"
|
||||
}
|
||||
stroke: "#0e7ccf",
|
||||
},
|
||||
}}
|
||||
size={32}
|
||||
/>
|
||||
|
||||
+18
-18
@@ -11,7 +11,7 @@ import {
|
||||
Spinner,
|
||||
TextInput,
|
||||
toaster,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
} from "evergreen-ui";
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
@@ -64,10 +64,10 @@ const Monaco = dynamic(() => import("../components/Monaco"), {
|
||||
>
|
||||
<Spinner />
|
||||
</Pane>
|
||||
)
|
||||
),
|
||||
});
|
||||
|
||||
export default function({
|
||||
export default function ({
|
||||
editable = true,
|
||||
title,
|
||||
settingElement,
|
||||
@@ -82,7 +82,7 @@ export default function({
|
||||
defaultValue,
|
||||
onChange,
|
||||
id,
|
||||
packageDetails
|
||||
packageDetails,
|
||||
}: EditorPanelProps) {
|
||||
const [showSettingsDialogue, setSettingsDialog] = useState(false);
|
||||
const [showPreview, setPreviewVisibility] = useState(true);
|
||||
@@ -96,10 +96,10 @@ export default function({
|
||||
codeLens: false,
|
||||
fontFamily: "Menlo, Consolas, monospace, sans-serif",
|
||||
minimap: {
|
||||
enabled: false
|
||||
enabled: false,
|
||||
},
|
||||
quickSuggestions: false,
|
||||
lineNumbers: "on"
|
||||
lineNumbers: "on",
|
||||
};
|
||||
|
||||
const _toggleSettingsDialog = useCallback(
|
||||
@@ -126,7 +126,7 @@ export default function({
|
||||
|
||||
{settingElement({
|
||||
toggle: _toggleSettingsDialog,
|
||||
open: showSettingsDialogue
|
||||
open: showSettingsDialogue,
|
||||
})}
|
||||
</>
|
||||
),
|
||||
@@ -146,19 +146,19 @@ export default function({
|
||||
}, []);
|
||||
|
||||
const { getRootProps } = useDropzone({
|
||||
onDrop: files => onFilePicked(files),
|
||||
onDrop: (files) => onFilePicked(files),
|
||||
disabled: !editable,
|
||||
accept: acceptFiles,
|
||||
onDropRejected: () =>
|
||||
toaster.danger("This file type is not supported.", {
|
||||
id
|
||||
})
|
||||
id,
|
||||
}),
|
||||
});
|
||||
|
||||
const copyValue = useCallback(() => {
|
||||
copy(value);
|
||||
toaster.success("Copied to clipboard.", {
|
||||
id
|
||||
id,
|
||||
});
|
||||
}, [value]);
|
||||
|
||||
@@ -166,7 +166,7 @@ export default function({
|
||||
prettierWorker
|
||||
.send({
|
||||
language,
|
||||
value
|
||||
value,
|
||||
})
|
||||
.then(setValue);
|
||||
}, [language, value]);
|
||||
@@ -176,7 +176,7 @@ export default function({
|
||||
}, [showPreview]);
|
||||
|
||||
const fetchFile = useCallback(
|
||||
close => {
|
||||
(close) => {
|
||||
(async () => {
|
||||
if (!fetchingUrl) return;
|
||||
const res = await fetch(fetchingUrl);
|
||||
@@ -229,7 +229,7 @@ export default function({
|
||||
<FilePicker
|
||||
width={"100%"}
|
||||
name="filepicker"
|
||||
onChange={files => onFilePicked(files, close)}
|
||||
onChange={(files) => onFilePicked(files, close)}
|
||||
accept={acceptFiles}
|
||||
/>
|
||||
|
||||
@@ -293,7 +293,7 @@ export default function({
|
||||
<a
|
||||
href={packageDetails.url}
|
||||
style={{
|
||||
display: "inline-flex"
|
||||
display: "inline-flex",
|
||||
}}
|
||||
target="_blank"
|
||||
>
|
||||
@@ -327,21 +327,21 @@ export default function({
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
flex: 1,
|
||||
overflow: "hidden"
|
||||
overflow: "hidden",
|
||||
}}
|
||||
{...getRootProps()}
|
||||
>
|
||||
{topNotifications &&
|
||||
topNotifications({
|
||||
isSettingsOpen: showSettingsDialogue,
|
||||
toggleSettings: _toggleSettingsDialog
|
||||
toggleSettings: _toggleSettingsDialog,
|
||||
})}
|
||||
|
||||
<Monaco
|
||||
language={language}
|
||||
value={value}
|
||||
options={options}
|
||||
onChange={value => {
|
||||
onChange={(value) => {
|
||||
setValue(value);
|
||||
onChange(value);
|
||||
}}
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ import { Dialog, Heading, Pane, Switch, TextInput, Select } from "evergreen-ui";
|
||||
export enum InputType {
|
||||
SWITCH = 1,
|
||||
TEXT_INPUT,
|
||||
SELECT
|
||||
SELECT,
|
||||
}
|
||||
|
||||
interface FormProps<T> {
|
||||
@@ -30,7 +30,7 @@ const Form = <T extends object>({
|
||||
title,
|
||||
formsFields,
|
||||
open,
|
||||
toggle
|
||||
toggle,
|
||||
}: FormProps<T> & { children?: React.ReactNode }) => {
|
||||
return (
|
||||
<Formik
|
||||
@@ -41,11 +41,11 @@ const Form = <T extends object>({
|
||||
title={title}
|
||||
isShown={open}
|
||||
onCloseComplete={toggle}
|
||||
onConfirm={close => {
|
||||
onConfirm={(close) => {
|
||||
props.submitForm();
|
||||
close();
|
||||
}}
|
||||
onCancel={close => {
|
||||
onCancel={(close) => {
|
||||
props.resetForm();
|
||||
close();
|
||||
}}
|
||||
@@ -120,7 +120,7 @@ const Form = <T extends object>({
|
||||
</Dialog>
|
||||
);
|
||||
}}
|
||||
onSubmit={values => {
|
||||
onSubmit={(values) => {
|
||||
onSubmit(values);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -5,12 +5,12 @@ import { lightEditor } from "@utils/theme";
|
||||
|
||||
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
||||
noSemanticValidation: true,
|
||||
noSyntaxValidation: true
|
||||
noSyntaxValidation: true,
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function(_moduleId, label) {
|
||||
getWorkerUrl: function (_moduleId, label) {
|
||||
if (label === "json") {
|
||||
return `/static/monaco/json.worker.js`;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ self.MonacoEnvironment = {
|
||||
return `/static/monaco/typescript.worker.js`;
|
||||
}
|
||||
return `/static/monaco/editor.worker.js`;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function noop() {}
|
||||
@@ -57,7 +57,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
|
||||
language: "javascript",
|
||||
options: {},
|
||||
editorDidMount: noop,
|
||||
theme: "light"
|
||||
theme: "light",
|
||||
};
|
||||
|
||||
public reLayout = () => {
|
||||
@@ -115,7 +115,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
|
||||
this.editor = editor.create(this.containerElement.current, {
|
||||
value,
|
||||
language,
|
||||
...options
|
||||
...options,
|
||||
});
|
||||
|
||||
editor.defineTheme("light", lightEditor);
|
||||
@@ -130,7 +130,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
|
||||
|
||||
editorDidMount(editor) {
|
||||
this.props.editorDidMount(editor);
|
||||
editor.onDidChangeModelContent(event => {
|
||||
editor.onDidChangeModelContent((event) => {
|
||||
const value = editor.getValue();
|
||||
|
||||
// Only invoking when user input changed
|
||||
@@ -146,7 +146,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
|
||||
const fixedHeight = processSize(height);
|
||||
const style = {
|
||||
width: fixedWidth,
|
||||
height: fixedHeight
|
||||
height: fixedHeight,
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -6,13 +6,13 @@ import { useRouter } from "next/router";
|
||||
import SearchBox from "@components/Searchbox";
|
||||
import loadScript from "load-script";
|
||||
|
||||
export default function() {
|
||||
export default function () {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (!IS_DEV)
|
||||
loadScript("https://codefund.io/properties/367/funder.js", {
|
||||
async: true
|
||||
async: true,
|
||||
});
|
||||
}, []);
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function() {
|
||||
flexDirection="column"
|
||||
paddingBottom={10}
|
||||
>
|
||||
{categorizedRoutes.map(route => {
|
||||
{categorizedRoutes.map((route) => {
|
||||
return (
|
||||
<Fragment key={route.category}>
|
||||
<Pane paddingX={10} marginTop={15} marginBottom={2}>
|
||||
@@ -53,7 +53,7 @@ export default function() {
|
||||
<Link key={a.label} href={a.path} prefetch={false}>
|
||||
<a
|
||||
style={{
|
||||
textDecoration: "none"
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
<Pane
|
||||
@@ -67,8 +67,8 @@ export default function() {
|
||||
}
|
||||
css={{
|
||||
"&:hover": {
|
||||
backgroundColor: "#f5f5f5"
|
||||
}
|
||||
backgroundColor: "#f5f5f5",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Text fontSize={13}>{a.label}</Text>
|
||||
|
||||
@@ -6,18 +6,18 @@ import { useRouter } from "next/router";
|
||||
const SearchBox: React.FunctionComponent<{}> = () => {
|
||||
const router = useRouter();
|
||||
|
||||
const onSearchSelect = useCallback(changedItem => {
|
||||
const route = routes.find(route => changedItem === route.searchTerm);
|
||||
const onSearchSelect = useCallback((changedItem) => {
|
||||
const route = routes.find((route) => changedItem === route.searchTerm);
|
||||
router.push(route.path);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Autocomplete
|
||||
onChange={onSearchSelect}
|
||||
items={routes.map(a => a.searchTerm)}
|
||||
items={routes.map((a) => a.searchTerm)}
|
||||
width="100%"
|
||||
>
|
||||
{props => {
|
||||
{(props) => {
|
||||
const { getInputProps, getRef, inputValue } = props;
|
||||
return (
|
||||
<SearchInput
|
||||
|
||||
@@ -23,7 +23,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
|
||||
formFields,
|
||||
optimizedValue,
|
||||
settings,
|
||||
setSettings
|
||||
setSettings,
|
||||
}) => {
|
||||
const getSettingsPanel = useCallback<EditorPanelProps["settingElement"]>(
|
||||
({ open, toggle }) => {
|
||||
@@ -73,14 +73,14 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
|
||||
}
|
||||
/>
|
||||
),
|
||||
previewElement: value => (
|
||||
previewElement: (value) => (
|
||||
<Pane display="flex" flexDirection="row" flex={1}>
|
||||
<Pane display={"flex"} flex={1} position="relative">
|
||||
<img
|
||||
style={{
|
||||
flex: 1,
|
||||
width: "100%",
|
||||
borderRight: "1px solid #eee"
|
||||
borderRight: "1px solid #eee",
|
||||
}}
|
||||
src={svgToDataUrl(value)}
|
||||
alt="original"
|
||||
@@ -101,7 +101,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
|
||||
<img
|
||||
style={{
|
||||
flex: 1,
|
||||
width: "100%"
|
||||
width: "100%",
|
||||
}}
|
||||
src={svgToDataUrl(optimizedValue)}
|
||||
alt="optimized"
|
||||
@@ -120,7 +120,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
|
||||
</Pane>
|
||||
</Pane>
|
||||
),
|
||||
acceptFiles: "image/svg+xml"
|
||||
acceptFiles: "image/svg+xml",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user