Skip to content

Commit

Permalink
Merge pull request #136 from yuvalg99/bug/share_link
Browse files Browse the repository at this point in the history
Bug/share link
  • Loading branch information
AykutSarac authored Sep 3, 2022
2 parents 75dbc41 + 0e4908b commit 16ee461
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Builder
FROM node:14-buster as builder
ARG jsoncrack_host
ENV NEXT_PUBLIC_JSONCRACK_HOST $jsoncrack_host
WORKDIR /src
COPY . /src
RUN yarn install --legacy-peer-deps
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</p>

<p align="center">
<img width="800" src="/public/jsoncrack-screenshot.webp" alt="preview 1" />
<img width="800" src="./public/jsoncrack-screenshot.webp" alt="preview 1" />
</p>

# JSON Crack (jsoncrack.com)
Expand Down Expand Up @@ -60,7 +60,7 @@ You can use the web version at [jsoncrack.com](https://jsoncrack.com) or also ru
A [`Dockerfile`](Dockerfile) is provided in the root of the repository.
If you want to run JSON Crack locally:

* Build a Docker image with `docker build -t jsoncrack .`
* Build a Docker image with `docker build -t jsoncrack --build-arg jsoncrack_host=localhost:8888 .`
* Run locally with `docker run -p 8888:8080 jsoncrack`
* Go to http://localhost:8888

Expand Down
6 changes: 4 additions & 2 deletions src/containers/Modals/ShareModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ const StyledContainer = styled.div`
}
`;

const jsoncrackHost = process.env.NEXT_PUBLIC_JSONCRACK_HOST || packageJson.homepage;

export const ShareModal: React.FC<ModalProps> = ({ visible, setVisible }) => {
const json = useConfig((state) => state.json);
const [encodedJson, setEncodedJson] = React.useState("");

const embedText = `<iframe src="${packageJson.homepage}/widget?json=${encodedJson}" width="512" height="384" style="border: 2px solid #b9bbbe; border-radius: 6px;"></iframe>`;
const shareURL = `${packageJson.homepage}/editor?json=${encodedJson}`;
const embedText = `<iframe src="${jsoncrackHost}/widget?json=${encodedJson}" width="512" height="384" style="border: 2px solid #b9bbbe; border-radius: 6px;"></iframe>`;
const shareURL = `${jsoncrackHost}/editor?json=${encodedJson}`;

React.useEffect(() => {
const jsonEncode = compress(JSON.parse(json));
Expand Down

0 comments on commit 16ee461

Please sign in to comment.