Skip to content

Commit

Permalink
Fix prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Cellule committed Apr 25, 2023
1 parent 11f0dd5 commit 1bb0f9f
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 38 deletions.
File renamed without changes.
36 changes: 32 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.2.2",
"typescript": "^5.0.2",
"vite": "^4.3.2"
}
Expand Down
33 changes: 5 additions & 28 deletions src/DisplayNpc.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import jsoncrush from "jsoncrush";
import {
debugNodeToString,
generate,
Npc,
NpcGenerateOptions,
} from "npc-generator";
import { debugNodeToString, generate, Npc, NpcGenerateOptions } from "npc-generator";
import React from "react";
import { Col, Row } from "react-bootstrap";
import { v4 as uuidV4 } from "uuid";
Expand Down Expand Up @@ -58,23 +53,11 @@ export default function DisplayNpc() {
<div className="title-image-wrapper">
<div className="title-image" />
</div>
<UserInput
npc={npcUid.npc}
generate={generateNpc}
onToggleHistory={handleToggleHistory}
/>
<UserInput npc={npcUid.npc} generate={generateNpc} onToggleHistory={handleToggleHistory} />
</div>
</Col>
<Col sm={12} md={7} lg={9}>
{isShowingHistory ? (
<NpcHistory
activeNpcUid={npcUid.uid || ""}
npcHistory={npcHistory}
onLoadNpc={handleLoadNpc}
/>
) : (
<NpcData npc={npcUid.npc} />
)}
{isShowingHistory ? <NpcHistory activeNpcUid={npcUid.uid || ""} npcHistory={npcHistory} onLoadNpc={handleLoadNpc} /> : <NpcData npc={npcUid.npc} />}
<Footer />
</Col>
<Icons8Disclaimer name="Npc" iconId="aFoL19SWLxKa/npc" />
Expand All @@ -93,9 +76,7 @@ function useNpcFromQuery(): GeneratedNpc | null {
if (url.searchParams.has("d")) {
try {
const crushedJson = url.searchParams.get("d") || "";
const npc: Npc | null = JSON.parse(
jsoncrush.uncrush(decodeURIComponent(crushedJson))
);
const npc: Npc | null = JSON.parse(jsoncrush.uncrush(decodeURIComponent(crushedJson)));
return npc ? { npc, uid: crushedJson } : null;
} catch (e) {
console.error(e);
Expand All @@ -107,11 +88,7 @@ function useNpcFromQuery(): GeneratedNpc | null {
function Icons8Disclaimer(props: { name: string; iconId: string }) {
return (
<div>
<a
target="_blank"
href={`https://icons8.com/icon/${props.iconId}`}
rel="noreferrer"
>
<a target="_blank" href={`https://icons8.com/icon/${props.iconId}`} rel="noreferrer">
{props.name}
</a>{" "}
icon by{" "}
Expand Down
10 changes: 5 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
);
2 changes: 1 addition & 1 deletion src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export interface GeneratedNpc {
npc: Npc;
uid: string;
generatedAt?: string;
}
}

0 comments on commit 1bb0f9f

Please sign in to comment.