Skip to content

Commit 26a49a6

Browse files
Refactor calendar and event section layout, update deps
Improves layout and accessibility for calendar and student council event sections by changing roles to 'region', updating grid/card styles, and removing redundant messages in calendar. Updates dependencies in package.json and bun.lock, and adjusts tsconfig for module resolution. Minor style tweaks in main.css for card and calendar components.
1 parent dabcef8 commit 26a49a6

8 files changed

Lines changed: 57 additions & 54 deletions

File tree

bun.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "learnit-plus-plus",
33
"displayName": "LearnIT++",
4-
"version": "1.6.5",
4+
"version": "1.6.6",
55
"description": "Improved design and functionality of the LearnIT page for IT-University of Copenhagen",
66
"author": "https://github.com/localhost-itu/learnit-plus-plus/graphs/contributors",
77
"repository": {
@@ -31,7 +31,7 @@
3131
"@fullcalendar/timegrid": "^6.1.19",
3232
"@plasmohq/messaging": "^0.7.2",
3333
"@plasmohq/storage": "^1.15.0",
34-
"caniuse-lite": "^1.0.30001752",
34+
"caniuse-lite": "^1.0.30001753",
3535
"firebase": "^12.5.0",
3636
"ical.js": "1.5.0",
3737
"plasmo": "0.90.5",
@@ -43,7 +43,7 @@
4343
"@ianvs/prettier-plugin-sort-imports": "4.7.0",
4444
"@tailwindcss/postcss": "^4.1.16",
4545
"@types/chrome": "0.1.27",
46-
"@types/node": "24.9.2",
46+
"@types/node": "24.10.0",
4747
"@types/react": "19.2.2",
4848
"@types/react-dom": "19.2.2",
4949
"autoprefixer": "^10.4.21",

src/components/calendar/calendarHeader.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ const CalendarHeader = ({ toggleView }: { toggleView: () => void }) => {
1919
alignItems: "center",
2020
gap: ".5rem"
2121
}}>
22-
{settings.icalSources.length == 0 && (
23-
<p className="bold">No custom calendars setup yet!</p>
24-
)}
2522

2623
<button className="btn btn-outline-secondary" onClick={toggleView}>
2724
Settings

src/components/calendar/calendarView.tsx

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,7 @@ const CalendarView = ({ toggleView }: { toggleView: () => void }) => {
9393
return (
9494
<>
9595
{settingsLoaded &&
96-
(settings.icalSources.length == 0 &&
97-
!settings.showScrollbar &&
98-
!settings.showStudentCouncil ? (
99-
<div className="calendar-missing-setup text-center">
100-
<h3>No calendars enabled</h3>
101-
<p>
102-
Go the settings view to add calendar subscriptions to your
103-
calendar
104-
</p>
105-
<p>
106-
<a
107-
href="https://github.com/PhilipFlyvholm/learnit-plus-plus/wiki/The-Calendar-Component"
108-
target="_blank">
109-
Guide for setup
110-
</a>
111-
</p>
112-
<button
113-
className="btn btn-outline-secondary my-2"
114-
onClick={toggleView}>
115-
Open settings
116-
</button>
117-
</div>
118-
) : (
96+
((
11997
<FullCalendar
12098
slotDuration={settings.slotduration}
12199
slotMinTime={settings.slotMinTime}
@@ -215,16 +193,19 @@ const CalendarView = ({ toggleView }: { toggleView: () => void }) => {
215193
firstDay={1} // Monday
216194
weekNumbers={true}
217195
weekends={settings.showWeekends}
196+
allDayText=""
218197
allDaySlot={
219198
settings.slotMinTime === "00:00:00" &&
220199
settings.slotMaxTime === "23:59:59"
221200
? false
222201
: undefined
223202
}
224203
height={"auto"}
225-
allDayText=""
226204
scrollTime={"08:00:00"}
227205
eventClick={(info) => {
206+
if (info.event.url.startsWith("https://learnit.itu.dk")) {
207+
return
208+
}
228209
info.jsEvent.preventDefault() // don't let the browser navigate
229210
if (info.event.url) {
230211
const url = info.event.url.startsWith("http")

src/contents/calendarRoot.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export const getRootContainer = () =>
2727
let section = region.querySelector<HTMLElement>("section.block_timeedit")
2828
if (!section) {
2929
section = document.createElement("section")
30-
section.className = "block_timeedit block card mb-3"
31-
section.setAttribute("role", "complementary")
30+
section.className = "block_timeedit block card"
31+
section.setAttribute("role", "region")
3232
section.setAttribute("data-block", "cohortspecifichtml")
3333
region.appendChild(section)
3434
}
@@ -55,6 +55,7 @@ const CalendarRoot = () => {
5555
const toggleView = () => {
5656
setCurrentView(currentView === "calendar" ? "settings" : "calendar")
5757
}
58+
console.log('CalendarRoot ext chrome', !!(window.chrome && (window as any).chrome.storage), 'runtime id', (window as any).chrome?.runtime?.id)
5859
return (
5960
<>
6061
{/* React root is on the draggable item, no extra wrapper needed */}

src/studentcouncil/eventSection.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { getEvents, type EventData } from "./eventLoader"
22

33
export async function addStudentConcileEvents() {
44
const section = document.createElement("section")
5-
section.className = "block_sc block card mb-3"
6-
section.setAttribute("role", "complementary")
5+
section.className = "block_sc block card"
6+
section.setAttribute("role", "region")
77
section.setAttribute("data-block", "cohortspecifichtml")
88

99
const div = document.createElement("div")
@@ -18,8 +18,10 @@ export async function addStudentConcileEvents() {
1818

1919
const cardTextDiv = document.createElement("div")
2020
cardTextDiv.className = "card-text content"
21-
cardTextDiv.style.display = "flex"
22-
cardTextDiv.style.flexWrap = "wrap"
21+
cardTextDiv.style.display = "grid"
22+
cardTextDiv.style.gridTemplateColumns = "repeat(2, 1fr)"
23+
cardTextDiv.style.gap = "10px"
24+
cardTextDiv.style.paddingTop = "1rem"
2325

2426
const events = await getEvents()
2527
if (events.length === 0) {
@@ -60,8 +62,6 @@ function getEventDom(event: EventData) {
6062
divCard.className = "card dashboard-card"
6163
divCard.setAttribute("role", "listitem")
6264
divCard.setAttribute("data-region", "course-content")
63-
divCard.style.width = "48%"
64-
divCard.style.margin = "1%"
6565

6666
const divCardBody = document.createElement("div")
6767
divCardBody.className = "card-body pr-1 course-info-container"
@@ -72,12 +72,14 @@ function getEventDom(event: EventData) {
7272
const header = document.createElement("h5")
7373
header.className = "coursename mr-2"
7474
header.textContent = event.summary
75+
header.style.margin = "0"
7576

7677
const divMuted = document.createElement("div")
7778
divMuted.className = "text-muted muted d-flex mb-1 justify-content-between"
7879

79-
const p = document.createElement("p")
80-
p.className = "text-truncate"
80+
const eventDate = document.createElement("span")
81+
eventDate.className = "text-truncate"
82+
eventDate.style.marginBottom = "0.5rem"
8183

8284
const date = new Date(event.dtstart)
8385
const weekDay = date.toLocaleDateString("en-GB", { weekday: "short" })
@@ -88,7 +90,7 @@ function getEventDom(event: EventData) {
8890
})
8991
const dateString = `${weekDay}, ${date.getDate()}. ${month}. ${time}`
9092

91-
p.textContent = `${dateString} | ${daysLeftString(date)}`
93+
eventDate.textContent = `${dateString} | ${daysLeftString(date)}`
9294
const expandedText = document.createElement("div")
9395
expandedText.className = "expandedText hide-content"
9496
const description = document.createElement("p")
@@ -122,7 +124,7 @@ function getEventDom(event: EventData) {
122124
expandedText.appendChild(readMoreButton)
123125
}
124126
divMuted.appendChild(expandedText)
125-
divMuted.appendChild(p)
127+
divMuted.appendChild(eventDate)
126128
divTextTruncate.appendChild(header)
127129
divTextTruncate.appendChild(divMuted)
128130
divCardBody.appendChild(divTextTruncate)

src/styles/main.css

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ body.limitedwidth #page.drawers .main-inner {
77
padding: 0.5rem 0.5rem !important;
88
}
99

10+
/* margin on card titles */
11+
html .block h3.card-title.d-inline {
12+
display: inline-block !important;
13+
margin-left: 0;
14+
margin-bottom: 0;
15+
}
16+
17+
html div.card-text.content:not:has(.calendarwrapper) {
18+
margin-top: 0 !important;
19+
padding-top: 1rem;
20+
}
21+
1022
/* Flex of starred courses */
1123
html div[data-region="card-deck"] {
1224
display: flex;
@@ -16,16 +28,13 @@ html div[data-region="card-deck"] {
1628
gap: 0.5rem;
1729
}
1830

19-
/* html div[data-region="card-deck"] > div {
20-
min-width: 150px;
21-
} */
22-
2331
/* enable four items to be in the starred card */
2432
/* .dashboard-card-deck:not(.fixed-width-cards) .dashboard-card { */
2533
html div[data-region="card-deck"] > div {
2634
width: unset !important;
2735
min-width: 200px;
2836
flex: 1;
37+
margin-bottom: 0 !important;
2938
}
3039

3140
/* remove stared courses padding */
@@ -169,6 +178,10 @@ section#block-region-content section.block_cohortspecifichtml {
169178
grid-area: tools;
170179
}
171180

181+
section[role="region"] {
182+
margin-bottom: 0 !important;
183+
}
184+
172185
/* Timeline sidebar fixes */
173186
html .block_timeline .timeline-action-button {
174187
margin-left: unset;
@@ -297,7 +310,7 @@ html .lightModeOnly {
297310
border: none;
298311
border-radius: 0.2rem;
299312
padding: 0.2rem 0.5rem;
300-
margin: 0.2rem 0.2rem;
313+
/* margin: 0.2rem 0.2rem; */
301314
cursor: pointer;
302315
}
303316

@@ -395,6 +408,10 @@ html .secondary-navigation {
395408
--fc-now-indicator-color: red;
396409
}
397410

411+
:root .fc .fc-toolbar.fc-header-toolbar {
412+
margin-bottom: 1rem;
413+
}
414+
398415
/* Questionnaire */
399416
html .qn-answer input[type="radio"] {
400417
margin: unset;

tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
],
1111
"compilerOptions": {
1212
"paths": {
13+
"assets/*": [
14+
"./assets/*"
15+
],
1316
"~*": [
1417
"./src/*"
1518
],
1619
"@Components/*": ["./src/components/*"]
1720
},
18-
"baseUrl": ".",
21+
// "module": "esnext",
22+
"moduleResolution": "bundler", // overwrite plasmo default as it is deprecated
1923
"jsx": "react-jsx",
2024
}
2125
}

0 commit comments

Comments
 (0)