diff --git a/src/CommonTypes/CommonTypes.tsx b/src/CommonTypes/CommonTypes.tsx
index 085c85e..0d8f615 100644
--- a/src/CommonTypes/CommonTypes.tsx
+++ b/src/CommonTypes/CommonTypes.tsx
@@ -8,6 +8,7 @@ import { twMerge } from "tailwind-merge"
import { CommonType } from "./CommonType"
import { ExportKnownTypes } from "./Export"
import { commonTypeNames$, commonTypes$, setSearch } from "./commonTypes.state"
+import { ImportKnownTypes } from "./Import"
export function CommonTypes({ className }: { className?: string }) {
const commonTypes = useStateObservable(commonTypes$)
@@ -40,14 +41,24 @@ export function CommonTypes({ className }: { className?: string }) {
return (
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
changeSearch(evt.target.value)}
onBlur={(evt) => {
diff --git a/src/CommonTypes/Export.tsx b/src/CommonTypes/Export.tsx
index 4f37d1c..9ccf64a 100644
--- a/src/CommonTypes/Export.tsx
+++ b/src/CommonTypes/Export.tsx
@@ -9,7 +9,7 @@ import {
} from "./commonTypes.state"
import { Checkbox } from "@radix-ui/themes"
-type RepositoryEntry = {
+export type RepositoryEntry = {
name: string
chains: string
paths: string[]
diff --git a/src/CommonTypes/Import.tsx b/src/CommonTypes/Import.tsx
new file mode 100644
index 0000000..40c7fbd
--- /dev/null
+++ b/src/CommonTypes/Import.tsx
@@ -0,0 +1,45 @@
+import { useEffect, useState } from "react"
+import { RepositoryEntry } from "./Export"
+import { commonTypeNames$, setTypeName } from "./commonTypes.state"
+
+export const ImportKnownTypes = () => {
+ const [done, setDone] = useState(false)
+
+ useEffect(() => {
+ const sub = commonTypeNames$.subscribe()
+ return () => sub.unsubscribe()
+ }, [])
+
+ const handleChange = (value: string) => {
+ try {
+ const result = JSON.parse(value) as Record
+ if (typeof result !== "object") throw new Error("Not an object")
+ Object.entries(result).forEach(([checksum, type]) => {
+ setTypeName({ checksum, name: type.name })
+ })
+ setDone(true)
+ } catch (ex) {
+ console.error(ex)
+ }
+ }
+
+ if (done) {
+ return (
+
+
Imported successfully!
+
+ )
+ }
+
+ return (
+
+
Paste here your saved types
+
+
+ )
+}