mirror of
https://github.com/Leado123/Leado123.github.io.git
synced 2026-10-01 00:32:59 +00:00
ui is nicer now, added new elemtns
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0,0" />
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&display=swap" rel="stylesheet">
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Share My Syllabus</title>
|
<title>Share My Syllabus</title>
|
||||||
|
|||||||
@@ -21,8 +21,10 @@
|
|||||||
"gh-pages": "^6.3.0",
|
"gh-pages": "^6.3.0",
|
||||||
"graphql": "^16.10.0",
|
"graphql": "^16.10.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
"react-doc-viewer": "^0.1.14",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-fast-marquee": "^1.6.5",
|
"react-fast-marquee": "^1.6.5",
|
||||||
|
"react-router-dom": "^7.1.3",
|
||||||
"tailwindcss": "^3.4.17"
|
"tailwindcss": "^3.4.17"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+17
-7
@@ -7,6 +7,7 @@ import { Accordion, FileInput } from "flowbite-react";
|
|||||||
|
|
||||||
import { Button, Label, Modal, TextInput } from "flowbite-react";
|
import { Button, Label, Modal, TextInput } from "flowbite-react";
|
||||||
import Marquee from 'react-fast-marquee';
|
import Marquee from 'react-fast-marquee';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
export const classOptions = [ // TODO REMOVE
|
export const classOptions = [ // TODO REMOVE
|
||||||
{ key: "nofilter", label: "No Class Filter" },
|
{ key: "nofilter", label: "No Class Filter" },
|
||||||
@@ -15,6 +16,7 @@ export const classOptions = [ // TODO REMOVE
|
|||||||
{ key: "physics", label: "Physics" },
|
{ key: "physics", label: "Physics" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var searchQuery = "";
|
||||||
|
|
||||||
function findIfMobile() {
|
function findIfMobile() {
|
||||||
//return true;
|
//return true;
|
||||||
@@ -37,8 +39,14 @@ function App() {
|
|||||||
|
|
||||||
|
|
||||||
async function handleSearch() {
|
async function handleSearch() {
|
||||||
|
if (query != "") searchQuery = query;
|
||||||
|
console.log(`searching for ${query}`);
|
||||||
try {
|
try {
|
||||||
var response = await fetch(`https://api.sharesyllabus.me/search/?q=${query}`);
|
if (searchQuery === "") {
|
||||||
|
var response = await fetch(`https://api.sharesyllabus.me/search/?q=${query}`);
|
||||||
|
} else {
|
||||||
|
var response = await fetch(`https://api.sharesyllabus.me/search/?q=${searchQuery}`);
|
||||||
|
}
|
||||||
var data = await response.json();
|
var data = await response.json();
|
||||||
console.log(data);
|
console.log(data);
|
||||||
setSyllabi(data);
|
setSyllabi(data);
|
||||||
@@ -91,9 +99,11 @@ function App() {
|
|||||||
console.log("temp file is", tempFileId)
|
console.log("temp file is", tempFileId)
|
||||||
}, [tempFileId])
|
}, [tempFileId])
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setQuery(searchQuery);
|
||||||
|
console.log("use effect ran");
|
||||||
handleSearch();
|
handleSearch();
|
||||||
|
|
||||||
if (findIfMobile()) {
|
if (findIfMobile()) {
|
||||||
@@ -105,7 +115,7 @@ function App() {
|
|||||||
console.log("pc")
|
console.log("pc")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[])
|
[location])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -143,7 +153,7 @@ function App() {
|
|||||||
<a href="portal.rcc.edu">MyPortal</a>
|
<a href="portal.rcc.edu">MyPortal</a>
|
||||||
<a href="https://www.norcocollege.edu/articulation/documents/norco-igetc-2024-25.pdf">IGETC</a>
|
<a href="https://www.norcocollege.edu/articulation/documents/norco-igetc-2024-25.pdf">IGETC</a>
|
||||||
<a href="https://www.norcocollege.edu/services/counseling/index.html">Counseling</a>
|
<a href="https://www.norcocollege.edu/services/counseling/index.html">Counseling</a>
|
||||||
<a href="https://mvc.edu/_resources/files/transfer/rccd-associate-degree-requirements.pdf">RCCD GE (Graduation Requirements)</a>
|
<a href="https://mvc.edu/_resources/files/transfer/rccd-associate-degree-requirements.pdf ">RCCD GE (Graduation Requirements)</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div className="">
|
||||||
<div className="flex space-x-1">
|
<div className="flex space-x-1">
|
||||||
@@ -165,7 +175,7 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="listing">
|
<div className="listing">
|
||||||
{syllabi.map((syllabus, i) => {
|
{syllabi.map((syllabus, i) => {
|
||||||
return <SyllabusListing key={i} fileName={syllabus.fileName} className={syllabus.className} professor={syllabus.professor} />
|
return <SyllabusListing key={i} fileName={syllabus.fileName} className={syllabus.className} description={syllabus.description} length={syllabus.length} professor={syllabus.professor} />
|
||||||
})}
|
})}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -189,13 +199,13 @@ function App() {
|
|||||||
</button></div>
|
</button></div>
|
||||||
<button onClick={() => setOpenModal(true)} className=" bg-blue-700 p-1 text-yellow-50 rounded-lg flex flex-row">
|
<button onClick={() => setOpenModal(true)} className=" bg-blue-700 p-1 text-yellow-50 rounded-lg flex flex-row">
|
||||||
<span className="flex justify-center items-center aspect-square flex-1"><i className="material-symbols-rounded">attach_file</i></span>
|
<span className="flex justify-center items-center aspect-square flex-1"><i className="material-symbols-rounded">attach_file</i></span>
|
||||||
<span className="text-xs">1 hr</span>
|
<span className="text-xs">1 hr</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="listing">
|
<div className="listing">
|
||||||
{syllabi.map((syllabus, i) => {
|
{syllabi.map((syllabus, i) => {
|
||||||
return <SyllabusListing key={i} fileName={syllabus.fileName} className={syllabus.className} professor={syllabus.professor} />
|
return <SyllabusListing key={i} fileName={syllabus.fileName} className={syllabus.className} description={syllabus.description} length={syllabus.length} professor={syllabus.professor} />
|
||||||
})}
|
})}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import DocViewer, { DocViewerRenderers } from "react-doc-viewer";
|
||||||
|
|
||||||
|
function findIfMobile() {
|
||||||
|
//return true;
|
||||||
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function View() {
|
||||||
|
|
||||||
|
const isMobile = findIfMobile();
|
||||||
|
|
||||||
|
const { file } = useParams();
|
||||||
|
const docs = [
|
||||||
|
{ uri: `https://api.sharesyllabus.me/files/${file}` }
|
||||||
|
]
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
console.log(docs[0].uri);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col space-y-2 justify-center align-middle w-full h-full m-0 p-4">
|
||||||
|
<nav className="w-full flex text-left pb-1 space-x-4">
|
||||||
|
<button onClick={() => navigate("/")} className="p-2 bg-white rounded-xl text-black aspect-square">
|
||||||
|
<i className="material-symbols-rounded">arrow_back</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="flex space-x-1 h-full items-center p-2 bg-blue-700 text-white rounded-xl">
|
||||||
|
<button onClick={() => window.location.replace(docs[0].uri)} className=" aspect-square">
|
||||||
|
<i className="material-symbols-rounded">download</i>
|
||||||
|
</button>
|
||||||
|
<text className=" font-medium pr-1">download</text>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button onClick={() => {
|
||||||
|
navigator.clipboard.writeText(docs[0].uri);
|
||||||
|
alert("Link Copied to Clipboard!");
|
||||||
|
}} className="p-2 bg-white rounded-xl text-black aspect-square">
|
||||||
|
<i className="material-symbols-rounded">share</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{isMobile ? <></> : <div className="h-full flex items-center justify-start align-middle">
|
||||||
|
<text className="text-xl text-left font-bold">Preview & Or Download</text>
|
||||||
|
</div>}
|
||||||
|
</nav>
|
||||||
|
<DocViewer className="flex-1 w-full rounded-xl" pluginRenderers={DocViewerRenderers} documents={docs}></DocViewer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default View;
|
||||||
@@ -19,6 +19,10 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#root {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #646cff;
|
color: #646cff;
|
||||||
|
|||||||
+10
-4
@@ -1,14 +1,20 @@
|
|||||||
import { StrictMode } from 'react'
|
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import App from './App.tsx'
|
import App from './App.tsx'
|
||||||
|
import View from './View.tsx'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
createRoot(document.getElementById('root')!).render(
|
createRoot(document.getElementById('root')!).render(
|
||||||
|
|
||||||
<StrictMode>
|
|
||||||
<App />
|
<Router>
|
||||||
</StrictMode>
|
<Routes>
|
||||||
|
<Route path="/" element={<App />} />
|
||||||
|
<Route path="/view/:file" element={<View />} />
|
||||||
|
</Routes>
|
||||||
|
</Router>
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
+33
-19
@@ -1,44 +1,58 @@
|
|||||||
import "./syllabuslisting.css";
|
import "./syllabuslisting.css";
|
||||||
import "./App.tsx";
|
import "./App.tsx";
|
||||||
|
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export interface ClassListing {
|
export interface ClassListing {
|
||||||
className: string;
|
className: string;
|
||||||
professor: string;
|
professor: string;
|
||||||
fileName: string;
|
fileName: string;
|
||||||
|
description: string;
|
||||||
|
length: number;
|
||||||
}
|
}
|
||||||
function findIfMobile() {
|
function findIfMobile() {
|
||||||
//return true;
|
//return true;
|
||||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||||
}
|
}
|
||||||
function SyllabusListing({className, professor, fileName}: ClassListing) {
|
function SyllabusListing({ className, professor, fileName, description, length }: ClassListing) {
|
||||||
|
|
||||||
async function handleDownload() {
|
const navigate = useNavigate();
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href= `https://api.sharesyllabus.me/files/${fileName}`;
|
async function handleView() {
|
||||||
a.download = fileName || 'syllabus.pdf';
|
navigate(`/view/${encodeURIComponent(`${fileName}`)}`);
|
||||||
a.click();
|
|
||||||
a.remove();
|
|
||||||
window.URL.revokeObjectURL(`https://api.sharesyllabus.me/files/${fileName}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!findIfMobile()) {
|
if (!findIfMobile()) {
|
||||||
|
|
||||||
return(
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="w-full flex bg-white text-black rounded-lg p-3">
|
<div className="w-full flex space-x-4 bg-white text-black rounded-lg p-3">
|
||||||
<span className=" font-extrabold">{className}</span>
|
<div className="flex text-left flex-col w-1/4">
|
||||||
<span className="flex-1">{professor}</span>
|
<span className="font-extrabold">{className}</span>
|
||||||
<button className="border-2 border-blue-600 p-1 rounded-lg" onClick={handleDownload}>download <br></br>pdf 📄</button>
|
<span className="flex-1 italic">{professor}</span>
|
||||||
|
{length > 7 ? <span className="text-xs font-light text-green-600">{length} weeks course (normal)</span> : <span className="text-xs font-light text-red-600">{length} weeks course</span>}
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 flex flex-col text-center">
|
||||||
|
<span className="w-3/4 font-serif">"{description}"</span>
|
||||||
|
</div>
|
||||||
|
<button className="aspect-square flex items-center align-middle justify-center rounded-lg hover:bg-slate-200 text-black" onClick={handleView}><span className="material-symbols-rounded text-2xl">open_in_new</span></button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return(
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="w-full flex flex-col text-left bg-white space-y-2 text-black rounded-lg p-3">
|
<div className="w-full flex flex-row text-left bg-white text-black rounded-lg p-3">
|
||||||
<span className=" font-extrabold">{className}</span>
|
<div className="flex-1 flex flex-col">
|
||||||
<span className="flex-1">{professor}</span>
|
<span className=" font-extrabold">{className}</span>
|
||||||
<button className="border-2 h-20 border-blue-600 p-1 rounded-lg" onClick={handleDownload}>view pdf 📄</button>
|
<span className="flex-1 italic">{professor}</span>
|
||||||
|
<span className="w-4/5 font-serif">"{description}"</span>
|
||||||
|
{length > 7 ? <span className="text-xs font-light text-green-600">{length} weeks course (normal)</span> : <span className="text-xs font-light text-red-600">{length} weeks course</span>}
|
||||||
|
</div>
|
||||||
|
<button className="flex items-center h-full p-2 rounded-lg bg-slate-200 text-black" onClick={handleView}>
|
||||||
|
<span className="material-symbols-rounded text-2xl">open_in_new</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-1
@@ -4,7 +4,11 @@ const flowbite = require("flowbite-react/tailwind");
|
|||||||
export default {
|
export default {
|
||||||
content: ["./src/**/*.{html,js,tsx}", flowbite.content()],
|
content: ["./src/**/*.{html,js,tsx}", flowbite.content()],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {},
|
extend: {
|
||||||
|
fontFamily: {
|
||||||
|
sserif: ["Source Serif 4", "serif"],
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
plugins: [flowbite.plugin()],
|
plugins: [flowbite.plugin()],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user