diff --git a/client/src/App.css b/client/src/App.css index 60deed4..25f9ac6 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -16,13 +16,14 @@ } #right-sidebar { - max-height: 100dvh; + /* max-height: 100dvh; */ + max-height: 100svh; } #main { - /* padding: 20px; */ width: 40%; - height: 100dvh; + /* height: 100dvh; */ + height: 100svh; overflow-y: auto; --dot-bg: var(--body_background); --dot-color: #4C4E52; @@ -43,7 +44,7 @@ .sidebar-btn { position: absolute; - z-index: 2; + z-index: 5; top: 50%; transform: translateY(-50%); } @@ -179,7 +180,7 @@ #main, #main.w-full { - padding-top: 70px; + padding-top: 60px; width: 100%; } @@ -189,7 +190,6 @@ .debates { padding: 10px; - padding-top: 0; gap: 10px; } } \ No newline at end of file diff --git a/client/src/components/loading/style.css b/client/src/components/loading/style.css index a923fba..1abaa35 100644 --- a/client/src/components/loading/style.css +++ b/client/src/components/loading/style.css @@ -14,7 +14,8 @@ } .loading-component { - height: calc(100dvh - 40px); + /* height: calc(100dvh - 40px); */ + height: calc(100svh - 40px); display: grid; place-items: center; } @@ -46,6 +47,7 @@ @media screen and (max-width: 480px) { .loading-component { - height: calc(100dvh - 150px); + /* height: calc(100dvh - 150px); */ + height: calc(100svh - 150px); } } \ No newline at end of file diff --git a/client/src/components/modal/auth/index.css b/client/src/components/modal/auth/index.css index 588ef0c..71b61d3 100644 --- a/client/src/components/modal/auth/index.css +++ b/client/src/components/modal/auth/index.css @@ -4,7 +4,8 @@ top: 0; left: 0; right: 0; - height: 100dvh; + /* height: 100dvh; */ + height: 100svh; backdrop-filter: blur(8px); display: flex; align-items: center; diff --git a/client/src/components/sidebar/left-sidebar.css b/client/src/components/sidebar/left-sidebar.css index 4ab4024..b2daac4 100644 --- a/client/src/components/sidebar/left-sidebar.css +++ b/client/src/components/sidebar/left-sidebar.css @@ -35,7 +35,8 @@ list-style: none; max-width: fit-content; height: 100%; - max-height: 100dvh; + /* max-height: 100dvh; */ + max-height: 100svh; margin: 0 auto; display: flex; flex-direction: column; diff --git a/client/src/components/sidebar/right-sidebar.css b/client/src/components/sidebar/right-sidebar.css index e6b700b..8c3089d 100644 --- a/client/src/components/sidebar/right-sidebar.css +++ b/client/src/components/sidebar/right-sidebar.css @@ -154,7 +154,8 @@ #right-sidebar .expand-menu__background.expand { z-index: 1; - height: 100dvh; + /* height: 100dvh; */ + height: 100svh; } .right-sidebar__container { diff --git a/client/src/pages/create-debate/editor.css b/client/src/pages/create-debate/editor.css new file mode 100644 index 0000000..6d75eda --- /dev/null +++ b/client/src/pages/create-debate/editor.css @@ -0,0 +1,92 @@ +.e-rte-container { + border: none; +} + +.e-richtexteditor { + min-width: 100%; + max-width: 100%; + min-height: 40vh !important; + background-color: var(--bg_primary); + color: var(--color_primary); + border: 1px solid var(--border_color); + overflow-x: hidden; +} + +.e-toolbar.e-extended-toolbar { + overflow-x: auto; +} + +.e-richtexteditor .e-toolbar-wrapper.e-rte-tb-float, +.e-richtexteditor .e-toolbar-container.e-rte-tb-float { + top: -20px !important; +} + +.e-richtexteditor .e-toolbar-wrapper { + z-index: 4 !important; + background-color: var(--bg_secondary); +} + +.e-toolbar, +.e-toolbar .e-toolbar-item.e-overlay, +.e-toolbar .e-toolbar-items, +.e-toolbar .e-toolbar-item .e-tbar-btn, +.e-toolbar.e-extended-toolbar .e-toolbar-pop, +.e-toolbar .e-toolbar-pop .e-toolbar-item:not(.e-separator), +.e-toolbar.e-extended-toolbar .e-toolbar-extended .e-toolbar-item .e-tbar-btn { + background-color: var(--bg_secondary); + color: #6c757d; +} + +.e-toolbar .e-toolbar-item.e-separator, +.e-toolbar.e-extended-toolbar .e-toolbar-extended .e-toolbar-item.e-separator { + border-color: var(--color_secondary); +} + +.e-toolbar .e-hor-nav { + background: var(--bg_secondary); +} + +.e-toolbar .e-popup-down-icon.e-icons { + color: var(--color_primary); +} + +.e-richtexteditor .e-rte-content { + z-index: 0 !important; + background-color: transparent; + color: inherit; +} + +.e-toolbar-wrapper { + border-bottom-color: var(--border_color); +} + +.e-richtexteditor .rte-placeholder, +.e-richtexteditor .e-rte-character-count { + color: var(--color_primary); +} + +.e-img-uploadwrap, +.e-droparea { + display: none; +} + +.e-dlg-content { + padding-top: 0 !important; +} + +.e-richtexteditor .e-resize-handle.e-south-east { + z-index: 0 !important; + cursor: ns-resize; +} + +.e-richtexteditor .e-rte-character-count { + z-index: 0 !important; +} + +@media screen and (max-width: 480px) { + + .e-richtexteditor .e-toolbar-wrapper.e-rte-tb-float, + .e-richtexteditor .e-toolbar-container.e-rte-tb-float { + top: -70px !important; + } +} \ No newline at end of file diff --git a/client/src/pages/create-debate/editor.tsx b/client/src/pages/create-debate/editor.tsx index d1448f6..f1839cb 100644 --- a/client/src/pages/create-debate/editor.tsx +++ b/client/src/pages/create-debate/editor.tsx @@ -1,3 +1,4 @@ +import "./editor.css" import { RichTextEditorComponent, Toolbar, @@ -13,15 +14,20 @@ import { Audio, FormatPainter, PasteCleanup, - Resize, + Resize } from "@syncfusion/ej2-react-richtexteditor" interface EditorProps { editorRef: React.RefObject - rteValue: string + rteValue?: string + isEditable: boolean + setDebateData?: React.Dispatch> } -const Editor: React.FC = ({ editorRef, rteValue }) => { +const Editor: React.FC = ({ editorRef, rteValue, isEditable, setDebateData }) => { const items = [ 'Undo', 'Redo', @@ -85,13 +91,22 @@ const Editor: React.FC = ({ editorRef, rteValue }) => { id="toolsRTE" ref={editorRef} value={rteValue} - showCharCount={true} - toolbarSettings={toolbarSettings} - quickToolbarSettings={quickToolbarSettings} - enableTabKey={true} - enableXhtml={true} + showCharCount={isEditable} + toolbarSettings={isEditable ? toolbarSettings : undefined} + quickToolbarSettings={isEditable ? quickToolbarSettings : undefined} + enableTabKey={isEditable} + enableXhtml={isEditable} placeholder="Your debate body" - enableResize={true} + enableResize={isEditable} + readonly={!isEditable} + change={(e: { value: string }) => { + if (isEditable && setDebateData) { + setDebateData(prevState => ({ + ...prevState, + body: e.value + })); + } + }} > = ({ isVisible, isFullscreen }) => { const editorRef = useRef(null); - const [editorContent, setEditorContent] = useState(''); + const [debateData, setDebateData] = useState({ title: '', body: '' }); + const [isPreview, setIsPreview] = useState(false); - const saveEditorContent = () => { - if (editorRef.current) { - const content = editorRef.current.value; - setEditorContent(content); + const handlePreviewToggle = () => { + if (!isPreview) { + if (editorRef.current) { + const content = editorRef.current.getHtml(); + setDebateData({ ...debateData, body: content }); + } } - }; console.log(editorContent); + + if (!debateData.title.trim()) return toast.warning("Enter debate title"); + + const tempDiv = document.createElement("div"); + tempDiv.innerHTML = editorRef.current?.value || ''; + const bodyText = tempDiv.textContent?.replace(/\u200B/g, '').trim(); + + if (!bodyText || bodyText === '
' || bodyText === '

' || bodyText === '


') { + return toast.warning("Enter debate body"); + } + + setIsPreview(!isPreview); + }; return ( -
-
-

Title

-