-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
592 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { GetPreviousRoomResponseDto, GetPreviousRoomsResponseDto } from "@/apis/conversation/dtos"; | ||
import https from "@/lib/https"; | ||
|
||
export const getPreviousRoomsApi = async ( | ||
currentPage: number, | ||
): Promise<GetPreviousRoomsResponseDto> => { | ||
const { data } = await https.get("/conversations", { | ||
params: { page: currentPage }, | ||
}); | ||
return new GetPreviousRoomsResponseDto(data); | ||
}; | ||
|
||
export const getPreviousRoom = async ( | ||
conversationId: string, | ||
) => { | ||
const { data } = await https.get<GetPreviousRoomResponseDto>(`/conversations/${conversationId}`); | ||
return data; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useFetcher } from "@/hooks/useFetcher"; | ||
import { Excalidraw } from "@excalidraw/excalidraw"; | ||
import { toUint8Array } from "js-base64"; | ||
import { yjsToExcalidraw } from "y-excalidraw"; | ||
import * as Y from "yjs"; | ||
|
||
interface ConversationSaveDrawBoardViewerProps { | ||
data: { | ||
url: string; | ||
isShared: boolean; | ||
}; | ||
} | ||
|
||
const ConversationSaveDrawBoardViewer = ({ | ||
data: { url }, | ||
}: ConversationSaveDrawBoardViewerProps) => { | ||
const { data } = useFetcher({ url }); | ||
|
||
if (!data) return null; | ||
|
||
const ydoc = new Y.Doc(); | ||
const binaryEndcoed = toUint8Array(data.data || ""); | ||
Y.applyUpdate(ydoc, binaryEndcoed); | ||
|
||
const yElements = ydoc.getArray<Y.Map<unknown>>("elements"); | ||
|
||
return ( | ||
<div className="h-[calc(100vh-12rem)]"> | ||
<Excalidraw | ||
initialData={{ | ||
elements: yjsToExcalidraw(yElements || new Y.Array<Y.Map<unknown>>()), | ||
appState: { | ||
viewModeEnabled: true, | ||
}, | ||
}} | ||
theme="light" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ConversationSaveDrawBoardViewer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useFetcher } from "@/hooks/useFetcher"; | ||
import { BlockNoteView } from "@blocknote/mantine"; | ||
import { useCreateBlockNote } from "@blocknote/react"; | ||
import "@blocknote/mantine/style.css"; | ||
import { useEffect } from "react"; | ||
|
||
interface ConversationSaveNoteViewerProps { | ||
data: { | ||
url: string; | ||
isShared: boolean; | ||
}; | ||
} | ||
|
||
const ConversationSaveNoteViewer = ({ | ||
data: { url }, | ||
}: ConversationSaveNoteViewerProps) => { | ||
const { data } = useFetcher({ url }); | ||
const editor = useCreateBlockNote({ | ||
animations: false, | ||
}); | ||
|
||
useEffect(() => { | ||
async function loadInitialHTML() { | ||
const blocks = await editor.tryParseMarkdownToBlocks(data?.data || ""); | ||
editor.replaceBlocks(editor.document, blocks); | ||
} | ||
loadInitialHTML(); | ||
}, [data]); | ||
|
||
return ( | ||
<div className="h-[calc(100vh-12rem)] py-2"> | ||
<BlockNoteView editor={editor} sideMenu={true} theme="light" /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ConversationSaveNoteViewer; |
Oops, something went wrong.