Skip to content

Commit fb061ce

Browse files
Superdoc UI (#171) (#172)
feedback text @ bottom info button Co-authored-by: YesMyNameIsMe <nguyen424787@gmail.com>
1 parent c6fb4b1 commit fb061ce

2 files changed

Lines changed: 40 additions & 7 deletions

File tree

‎frontend/src/components/Navbar.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Navbar = () => {
4646

4747
{/* Logo */}
4848
<button
49-
className="flex items-center flex-shrink-0 transition duration-300 transform hover:scale-110 z-60"
49+
className="flex items-center flex-shrink-0 transition duration-300 transform hover:scale-110 z-6 cursor-pointer"
5050
onClick={() => { window.scrollTo(0, 0); user ? navigate('/home') : navigate('/'); }}
5151
>
5252
<img src="/assets/Logo.svg" alt="Nexus Logo" className="h-9 w-9 md:h-10 md:w-auto" />

‎frontend/src/pages/superdoc.jsx‎

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect, useRef } from 'react';
22
import StarFieldOverlay from '../components/StarFieldOverlay';
3-
import { HiOutlineDocument, HiUpload, HiChevronLeft, HiChevronRight, HiChevronDown, HiOutlineUpload, HiArrowLeft, HiSearch, HiOutlineFolder, HiDocument, HiLink, HiDocumentDuplicate, HiDocumentAdd } from 'react-icons/hi';
3+
import { HiOutlineDocument, HiUpload, HiChevronLeft, HiChevronRight, HiChevronDown, HiOutlineUpload, HiArrowLeft, HiSearch, HiOutlineFolder, HiDocument, HiLink, HiDocumentDuplicate, HiDocumentAdd, HiQuestionMarkCircle } from 'react-icons/hi';
44
import { motion, AnimatePresence } from 'framer-motion';
55
import { useMobile } from '../context/mobileContext';
66
import 'simplebar-react/dist/simplebar.min.css';
@@ -36,6 +36,18 @@ function SuperDoc() {
3636
const [docUrl, setDocUrl] = useState('')
3737
const [docIdMap, setDocIdMap] = useState(new Map()) // docName -> googleDocId
3838
const [isDocContentLoading, setIsDocContentLoading] = useState(false)
39+
const [isInfoOpen, setInfoOpen] = useState(false)
40+
const infoRef = useRef(null)
41+
42+
useEffect(() => {
43+
const handleClickOutside = (event) => {
44+
if(infoRef.current && !infoRef.current.contains(event.target)) {
45+
setInfoOpen(false)
46+
}
47+
}
48+
document.addEventListener("mousedown", handleClickOutside)
49+
return () => {document.removeEventListener("mousedown", handleClickOutside)}
50+
}, [])
3951

4052
const handleScroll = (e) => {
4153
const { scrollTop, scrollHeight, clientHeight } = e.target;
@@ -240,7 +252,7 @@ function SuperDoc() {
240252
</motion.div>
241253
{ /* ------------------------------- DOC SIDE BAR ------------------------------------ */}
242254
<motion.div
243-
className="shadow-md flex flex-col h-screen fixed left-0 top-0 pt-20 overflow-visible z-40 w-[clamp(200px,17%,500px)]"
255+
className="shadow-md flex flex-col h-screen fixed left-0 top-0 pt-20 overflow-visible z-40 w-[clamp(200px,17vw,500px)]"
244256
transition={{ type: "tween", duration: 0.4 }}
245257
style={{backgroundImage: 'linear-gradient(#002966, #001433)'}}>
246258

@@ -392,10 +404,10 @@ function SuperDoc() {
392404
</AnimatePresence>
393405
</motion.div>
394406
{/* ---------------------------------- MAIN CONTENT ------------------------------------ */}
395-
<div className={`flex h-full w-full flex-col items-end px-10`}>
407+
<div className={`flex h-full w-full flex-col px-10 `}>
396408
<AnimatePresence>
397409
<motion.div transition={{duration: 0.4}}
398-
className={`w-full h-full mt-20 z-30 pl-[clamp(200px,17%,500px)]`}>
410+
className={`w-full h-full mt-20 z-30 pl-[clamp(200px,17vw,500px)]`}>
399411

400412
{/* ----------------------------- SUPER DOC ----------------------------------- */}
401413
<div className='flex flex-row w-full h-full justify-between items-center'>
@@ -413,9 +425,25 @@ function SuperDoc() {
413425
</h2>
414426
}
415427
</div>
416-
<div className='flex'>
428+
<div className='flex flex-row gap-2'>
417429
{/* use the href to direct them to the google doc link */}
418430
<Button className={"p-2 "} href={docUrl ? docUrl.replace('/preview', '/edit') : undefined} disabled={!docUrl} title={"Go to Google Doc"} icon={<HiLink size={25} color='white'/>}/>
431+
<div className='flex w-full h-full relative items-start justify-end' ref={infoRef}>
432+
<Button className={"p-2 bg-transparent"} onClick={() => setInfoOpen(!isInfoOpen)} title={"Go to Google Doc"} icon={<HiQuestionMarkCircle className='opacity-50 hover:opacity-100 transition duration-300' size={25} color='white'/>}/>
433+
<AnimatePresence>
434+
{isInfoOpen && (
435+
<motion.div transition={{duration:0.3}} initial={{x:5, opacity:0}} animate={{x:0, opacity:1}} exit={{x:5, opacity:0}}
436+
className="absolute items-center justify-center mr-10 bg-nexus800 w-[clamp(250px,17vw,300px)] p-3 rounded-lg shadow-2xl"
437+
>
438+
439+
<span className='flex text-[clamp(0.8rem,1.3vw,2rem)] text-white font-titilliumWeb-regular'>
440+
Welcome to SuperDoc, your communal study guide! Choose a class, then create a doc or merge in your notes (as a PDF). We'll remove redundancy and combine your shared knowledge. You can also edit these from the Discord channel for your class.
441+
</span>
442+
443+
444+
</motion.div>)}
445+
</AnimatePresence>
446+
</div>
419447
</div>
420448
</div>
421449

@@ -470,6 +498,11 @@ function SuperDoc() {
470498

471499
</AnimatePresence>
472500
</div>
501+
<div className='pl-[clamp(200px,17%,500px)] w-full items-center text-center pb-5'>
502+
<span className='text-gray-400 font-titilliumWeb-semibold tinyText'>
503+
This feature is in development. If you experience issues or have feedback, please fill out the feedback form found on the home page.
504+
</span>
505+
</div>
473506
</div>
474507
)
475508
}

0 commit comments

Comments
 (0)