Skip to content

Commit b47441c

Browse files
feat: load from existing storefront (#458)
* feat: upload logo to ipfs in custom store * feat: load all values from another custom store front * feat: load all values from custom store * feat: try to always load customstore url * fix: logo upload logic * feat: enable strict mode again * feat: ignore non-existing keys * feat: change copies * feat: move template url input to the top * fix: loading from url * fix: template input * feat: blue notification after copying url
1 parent e58a5e0 commit b47441c

3 files changed

Lines changed: 221 additions & 43 deletions

File tree

src/components/modal/components/CustomStore.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as Tooltip from "@radix-ui/react-tooltip";
22
import { Copy, CopySimple, Info } from "phosphor-react";
33
import * as pretty from "pretty";
4+
import { useState } from "react";
45
import toast from "react-hot-toast";
56
import styled from "styled-components";
67

78
import Collapse from "../../../components/collapse/Collapse";
89
import { colors } from "../../../lib/styles/colors";
910
import copyToClipboard from "../../../lib/utils/copyToClipboard";
11+
import { Notify } from "../../detail/Detail.style";
1012
import { CopyButton } from "../../form/Field.styles";
1113
import BosonButton from "../../ui/BosonButton";
1214
import Grid from "../../ui/Grid";
@@ -64,6 +66,8 @@ export default function CustomStore({
6466
htmlString = "",
6567
hideModal
6668
}: Props) {
69+
const [show, setShow] = useState<boolean>(false);
70+
6771
const iframeString = htmlString.substring(
6872
htmlString.indexOf("<iframe"),
6973
htmlString.indexOf("</body")
@@ -103,8 +107,21 @@ export default function CustomStore({
103107
</a>
104108
<CopyIcon
105109
size={20}
106-
onClick={() => copyToClipboard(ipfsUrl).catch(console.error)}
110+
onClick={async () => {
111+
try {
112+
await copyToClipboard(ipfsUrl);
113+
setShow(true);
114+
setTimeout(() => {
115+
setShow(false);
116+
}, 3000);
117+
} catch (error) {
118+
console.error(error);
119+
}
120+
}}
107121
/>
122+
<Notify $show={show}>
123+
<Typography tag="p">URL has been copied to clipboard</Typography>
124+
</Notify>
108125
</Grid>
109126
</CollapsibleContainer>
110127
<CollapsibleContainer>

0 commit comments

Comments
 (0)