Skip to content

Commit

Permalink
Update AiSelector.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
juliopavila committed May 24, 2024
1 parent f32abc9 commit 20165a4
Show file tree
Hide file tree
Showing 40 changed files with 442 additions and 2,128 deletions.
6 changes: 1 addition & 5 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@mui/material": "^5.5.0",
"@mui/styles": "^5.5.0",
"@nanostores/react": "ai/react",
"@tiptap/extension-code-block-lowlight": "^2.4.0",
"@tiptap/html": "^2.4.0",
"@types/dompurify": "^3.0.5",
"@web3modal/ethers5": "^4.1.11",
"ai": "^3.1.12",
Expand All @@ -47,10 +47,6 @@
"class-variance-authority": "^0.7.0",
"datastore-core": "^9.0.0",
"dompurify": "^3.1.4",
"draft-convert": "^2.1.13",
"draft-js": "^0.11.7",
"draft-js-export-html": "^1.4.1",
"draft-js-import-html": "^1.4.1",
"ethers": "^5.7.2",
"gh-pages": "^3.2.3",
"graphql": "^16.3.0",
Expand Down
13 changes: 6 additions & 7 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useState } from "react"
import React, { useEffect, useState } from "react"
import { PublicationView } from "@/components/views/publication/PublicationView"
import { Routes, Route, useLocation } from "react-router-dom"
import { SnackbarProvider } from "notistack"
Expand Down Expand Up @@ -29,7 +29,6 @@ const App: React.FC = () => {
useEffect(() => {
const pathParts = location.pathname.split("-")
let urlChainId = pathParts[0].replace("/", "")
console.log("urlChainId", urlChainId)
const validChainIds = CHAINS.map((chain) => chain.id.toString())

if (!validChainIds.includes(urlChainId) && userChainId) {
Expand Down Expand Up @@ -59,18 +58,18 @@ const App: React.FC = () => {
<Route path="/" element={<LandingView />} />
<Route path="/publications" element={<PublicationsView />} />
<Route path=":publicationSlug" element={<PublicationView />} />
{/* <Route path="/goerli/*" element={<RedirectOldRoute />} />
<Route path="/goerli/*" element={<RedirectOldRoute />} />
<Route path="/mainnet/*" element={<RedirectOldRoute />} />
<Route path="/gnosis_chain/*" element={<RedirectOldRoute />} />
<Route path="/polygon/*" element={<RedirectOldRoute />} />
<Route path="/arbitrum/*" element={<RedirectOldRoute />} />
<Route path="/optimism/*" element={<RedirectOldRoute />} /> */}
<Route path="/optimism/*" element={<RedirectOldRoute />} />
<Route path=":publicationSlug">
<Route path="permissions/:type" element={<PermissionView />} />
{/* <Route path="new" element={<CreateArticleView type="new" />} />
<Route path="new" element={<CreateArticleView type="new" />} />
<Route path="edit" element={<CreateArticleView type="edit" />} />
<Route path=":type/preview" element={<PreviewArticleView />} />
<Route path=":articleId" element={<ArticleView updateChainId={updateChainId} />} />
<Route path=":articleId/edit" element={<CreateArticleView type="edit" />} /> */}
<Route path=":articleId" element={<ArticleView />} />
</Route>
</Routes>
</PosterProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useCallback, useMemo, useRef } from "react"
import Sketch from "react-p5"
import p5Types from "p5"
//@ts-ignore
import Random, { genTokenData } from "./utils"
import { Box } from "@mui/material"
import { Piece } from "./Piece"
Expand Down
9 changes: 4 additions & 5 deletions packages/app/src/components/commons/Editor/AdvanceEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const useStyles = makeStyles((theme: any) => ({
const Editor: React.FC<EditorProps> = ({ initialValue, onChange, onHtml }) => {
const classes = useStyles()
const extensions = useExtensions()
const [saveStatus, setSaveStatus] = useState("Saved")
// const [saveStatus, setSaveStatus] = useState("Saved")
const [openNode, setOpenNode] = useState<boolean>(false)
const [openLink, setOpenLink] = useState<boolean>(false)
const { suggestionItems, slashCommand } = useSuggestionItems()
Expand All @@ -134,13 +134,13 @@ const Editor: React.FC<EditorProps> = ({ initialValue, onChange, onHtml }) => {

const debouncedUpdates = useDebouncedCallback(async (editor: EditorInstance) => {
const json = editor.getJSON()
console.log("editor", editor)

// window.localStorage.setItem("html-content", editor.getHTML())
// window.localStorage.setItem("novel-content", JSON.stringify(json))
// window.localStorage.setItem("markdown", editor.storage.markdown.getMarkdown())
onChange(json)
onHtml(editor.getHTML())
setSaveStatus("Saved")
// setSaveStatus("Saved")
}, 500)

// useEffect(() => {
Expand All @@ -149,7 +149,6 @@ const Editor: React.FC<EditorProps> = ({ initialValue, onChange, onHtml }) => {
// else setInitialContent(defaultEditorContent)
// }, [])

// if (!initialContent) return null
return (
<EditorRoot>
<EditorContent
Expand All @@ -169,7 +168,7 @@ const Editor: React.FC<EditorProps> = ({ initialValue, onChange, onHtml }) => {
}}
onUpdate={({ editor }) => {
debouncedUpdates(editor)
setSaveStatus("Unsaved")
// setSaveStatus("Unsaved")
}}
slotAfter={<ImageResizer />}
>
Expand Down
Loading

0 comments on commit 20165a4

Please sign in to comment.