Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions apps/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"check:types": "tsc -noEmit"
},
"dependencies": {
"@albert-plus/server": "workspace:*",
"@clerk/chrome-extension": "^2.7.8",
"convex": "^1.28.0",
"plasmo": "0.90.5",
Expand All @@ -31,11 +32,15 @@
"manifest": {
"permissions": [
"cookies",
"storage"
"storage",
"activeTab",
"sidePanel"
],
"host_permissions": [
"$PLASMO_PUBLIC_CLERK_SYNC_HOST/*",
"$CLERK_FRONTEND_API/*"
"$CLERK_FRONTEND_API/*",
"https://sis.nyu.edu/*",
"https://albert.nyu.edu/*"
]
}
}
40 changes: 40 additions & 0 deletions apps/browser/src/background.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
chrome.runtime.onMessage.addListener((request, _sender, sendResponse) => {

switch (request.type) {
case "SAVE_ENROLLED_COURSES":
chrome.storage.local.set({
enrolledCourses: request.payload,
lastSync: new Date().toISOString()
}, () => {
console.log("Saved enrolled course offerings to local storage:", request.payload);
});
break;
case "SAVE_COMPLETED_COURSES":
chrome.storage.local.set({
completedCourses: request.payload,
gradesLastSync: new Date().toISOString()
}, () => {
console.log("Saved completed courses to local storage:", request.payload);
});
break;
case "SAVE_COURSE_SEARCH":
chrome.storage.local.get("courseSearchSaved", (result) => {
const courseSearchSaved = result.courseSearchSaved || [];
courseSearchSaved.push(request.payload);
chrome.storage.local.set({
courseSearchSaved: courseSearchSaved,
savedAt: new Date().toISOString()
}, () => {
console.log("Saved course search to local storage:", request.payload);
});
});
break;
default:
console.log("Unknown message type:", request.type);
sendResponse({ error: "Unknown message type" });
}
});

chrome.runtime.onInstalled.addListener(() => {
chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true });
});
27 changes: 27 additions & 0 deletions apps/browser/src/components/Course.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
interface CourseProps {
courseCode: string;
title: string;
timeStart: string;
timeEnd: string;
instructor: string;
}

const Course = ({
courseCode,
title,
timeStart,
timeEnd,
instructor,
}: CourseProps) => {
return (
<div className="plasmo-flex plasmo-flex-row plasmo-items-center plasmo-justify-between plasmo-gap-2 plasmo-text-md plasmo-font-medium plasmo-rounded-md plasmo-p-2 plasmo-bg-gray-50">
<div className="plasmo-flex plasmo-flex-col">
<span className="plasmo-font-normal">{courseCode}</span>
<span className="plasmo-font-semibold">{title}</span>
</div>
<div>Details</div>
</div>
);
};

export default Course;
Loading
Loading