Skip to content

Commit 76d5baf

Browse files
authored
Merge pull request #101 from filips123/frontend-fixes
Implement a new frontend fixes
2 parents da93d07 + 0c6f2aa commit 76d5baf

File tree

9 files changed

+73
-66
lines changed

9 files changed

+73
-66
lines changed

website/src/App.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const navigation: { title: string; link: string; icon: string }[] = [
8383

8484
<template>
8585
<v-app>
86-
<v-app-bar class="pr-2">
86+
<v-app-bar class="app-bar pr-2">
8787
<v-app-bar-title>
8888
<h1 class="app-title">{{ routerTitle }}</h1>
8989
<div v-if="showEntityName" class="app-subtitle">{{ currentEntityList.join(', ') }}</div>
@@ -119,15 +119,24 @@ const navigation: { title: string; link: string; icon: string }[] = [
119119
<style>
120120
/* Set styles for app title and subtitle */
121121
122+
.app-bar {
123+
user-select: none;
124+
}
125+
122126
.app-title {
123127
font-size: 1.25rem;
124128
font-weight: 500;
125129
letter-spacing: 0.0125em;
130+
text-overflow: ellipsis;
131+
overflow-x: hidden;
126132
}
127133
128134
.app-subtitle {
129135
font-size: 0.9rem;
130136
color: rgba(var(--v-theme-on-primary), var(--v-app-subtitle-opacity));
137+
text-overflow: ellipsis;
138+
overflow-x: auto;
139+
scrollbar-width: none;
131140
}
132141
133142
/* Fix pull to refresh colors in dark theme */

website/src/assets/main.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ td {
2525
}
2626

2727
a {
28-
color: rgb(var(--v-theme-primary-variant));
28+
color: rgb(var(--v-theme-secondary));
2929
text-decoration: none;
3030
}
3131

@@ -81,6 +81,22 @@ li {
8181
background: rgb(var(--v-overlay-color)) !important;
8282
}
8383

84+
/* Fix bottom navigation not being centered */
85+
86+
.v-bottom-navigation__content > .v-btn {
87+
width: 0 !important;
88+
}
89+
90+
/* Fix transition on window item swiping */
91+
92+
.v-window__container {
93+
margin: 0 -8px;
94+
}
95+
96+
.v-window-item {
97+
padding: 0 8px;
98+
}
99+
84100
/* Disable unnecessary Vuetify transitions */
85101

86102
.v-card,

website/src/components/AppSnackbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { buttonAction, buttonText, show, text, timeout } = storeToRefs(useSnackba
99
<template>
1010
<v-snackbar v-model="show" :text :timeout color="surface-medium">
1111
<template v-if="buttonText" #actions>
12-
<v-btn :text="buttonText" color="primary-variant" @click="buttonAction" />
12+
<v-btn :text="buttonText" color="secondary" @click="buttonAction" />
1313
</template>
1414
</v-snackbar>
1515
</template>

website/src/components/SettingsBaseAction.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ function doAction() {
5757
}
5858
5959
.settings-base-action:focus-visible {
60-
outline-color: rgba(
61-
var(--v-theme-primary-variant),
62-
calc(0.25 * var(--v-theme-overlay-multiplier))
63-
);
60+
outline-color: rgba(var(--v-theme-secondary), calc(0.25 * var(--v-theme-overlay-multiplier)));
6461
}
6562
</style>

website/src/components/SettingsSelectEntity.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,28 @@ onMounted(() => {
8888
)
8989
})
9090
91+
function pushState(entityTypeDialog: boolean, entityListDialog: boolean) {
92+
history.pushState(
93+
{
94+
...history.state,
95+
position: history.state.position + 1,
96+
replaced: false,
97+
scroll: null,
98+
entityTypeDialog,
99+
entityListDialog,
100+
},
101+
'',
102+
)
103+
}
104+
91105
watch(displayed, value => {
92106
if (value) {
93107
// Show the type selection dialog
94108
entityTypeDialog.value = true
95109
entityListDialog.value = false
96110
97111
// Push a new history state where the type dialog is displayed
98-
history.pushState(
99-
{
100-
...history.state,
101-
entityTypeDialog: true,
102-
entityListDialog: false,
103-
},
104-
'',
105-
)
112+
pushState(true, false)
106113
}
107114
108115
if (!value) {
@@ -121,7 +128,7 @@ watch(displayed, value => {
121128
)
122129
123130
// Ensure the history stack is consistent
124-
history.pushState(history.state, '')
131+
pushState(false, false)
125132
history.back()
126133
}
127134
})
@@ -162,14 +169,7 @@ function handleSelectEntityType(selectedEntity: EntityType) {
162169
entityListDialog.value = true
163170
164171
// Push a new history state where the list dialog is displayed
165-
history.pushState(
166-
{
167-
...history.state,
168-
entityTypeDialog: false,
169-
entityListDialog: true,
170-
},
171-
'',
172-
)
172+
pushState(false, true)
173173
}
174174
175175
function handleViewEntityList() {

website/src/components/TimetableDisplay.vue

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,15 @@ function filterForTargetDay(lessonsTime: MergedLesson[][]) {
8686
</thead>
8787

8888
<tbody>
89-
<tr
90-
v-for="(lessonsTime, timeIndex) in lessons"
91-
:key="timeIndex"
92-
class="timetable-row"
93-
:class="daySpecific ? lessonStyles(targetDay!, timeIndex) : undefined"
94-
:tabindex="daySpecific ? 0 : undefined"
95-
@click="daySpecific ? handleDetails(targetDay!, timeIndex, $event) : undefined"
96-
@keydown.enter="daySpecific ? handleDetails(targetDay!, timeIndex, $event) : undefined"
97-
>
98-
<template v-if="timeIndex >= timeInterval[0] && timeIndex <= timeInterval[1]">
89+
<template v-for="(lessonsTime, timeIndex) in lessons" :key="timeIndex">
90+
<tr
91+
v-if="timeIndex >= timeInterval[0] && timeIndex <= timeInterval[1]"
92+
class="timetable-row"
93+
:class="daySpecific ? lessonStyles(targetDay!, timeIndex) : undefined"
94+
:tabindex="daySpecific ? 0 : undefined"
95+
@click="daySpecific ? handleDetails(targetDay!, timeIndex, $event) : undefined"
96+
@keydown.enter="daySpecific ? handleDetails(targetDay!, timeIndex, $event) : undefined"
97+
>
9998
<td class="time-number" v-text="timeIndex === 0 ? 'PU' : timeIndex + '.'" />
10099
<td
101100
v-if="!daySpecific && showHoursInTimetable"
@@ -124,8 +123,8 @@ function filterForTargetDay(lessonsTime: MergedLesson[][]) {
124123
</table>
125124
<TimetableEmptyClassrooms v-else :lessons="lessonsTimeDay" />
126125
</td>
127-
</template>
128-
</tr>
126+
</tr>
127+
</template>
129128
</tbody>
130129
</v-table-main>
131130
</template>

website/src/plugins/vuetify.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const lightTheme: ThemeDefinition = {
1010
dark: false,
1111
colors: {
1212
primary: '#008800',
13-
'primary-variant': '#007700',
13+
secondary: '#007700',
1414
'surface-subtle': '#f6f6f6',
1515
'surface-medium': '#e6e6e6',
1616
'surface-highlighted': '#efefef',
@@ -29,7 +29,7 @@ const darkTheme: ThemeDefinition = {
2929
dark: true,
3030
colors: {
3131
primary: '#008800',
32-
'primary-variant': '#369d36',
32+
secondary: '#369d36',
3333
'surface-subtle': '#1c1c1c',
3434
'surface-medium': '#262626',
3535
'surface-highlighted': '#2c2c2c',
@@ -94,7 +94,7 @@ const vuetify = createVuetify({
9494
variant: 'text',
9595
},
9696
VBtnSubscribe: {
97-
color: 'primary-variant',
97+
color: 'secondary',
9898
class: 'px-1 ms-n1 me-2',
9999
variant: 'text',
100100
},
@@ -115,16 +115,16 @@ const vuetify = createVuetify({
115115
color: 'primary',
116116
},
117117
VSwitch: {
118-
color: 'primary-variant',
118+
color: 'secondary',
119119
},
120120
VCheckbox: {
121-
color: 'primary-variant',
121+
color: 'secondary',
122122
},
123123
VRadioGroup: {
124-
color: 'primary-variant',
124+
color: 'secondary',
125125
},
126126
VTextField: {
127-
color: 'primary-variant',
127+
color: 'secondary',
128128
},
129129
VDialog: {
130130
width: '50rem',
@@ -155,7 +155,7 @@ const vuetify = createVuetify({
155155
class: 'pa-0',
156156
},
157157
VBtn: {
158-
color: 'primary-variant',
158+
color: 'secondary',
159159
variant: 'text',
160160
},
161161
},

website/src/registerSentry.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
99
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
1010
setHttpStatus,
11-
spanToJSON,
1211
startBrowserTracingNavigationSpan,
1312
} from '@sentry/browser'
1413
import type { Integration, Span, SpanAttributes, TransactionSource } from '@sentry/types'
@@ -202,7 +201,6 @@ function browserTracingIntegration(router: Router): Integration {
202201

203202
router.beforeEach((to, from) => {
204203
const attributes: SpanAttributes = {
205-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue',
206204
'route.name': to.name as string,
207205
'route.path': to.path as string,
208206
'route.hash': to.hash as string,
@@ -250,17 +248,14 @@ function browserTracingIntegration(router: Router): Integration {
250248
if (instrumentPageLoad && isPageLoadNavigation) {
251249
const activeRootSpan = getActiveRootSpan()
252250
if (activeRootSpan) {
253-
// Replace the name of the existing root span if it was not custom set
254-
const existingAttributes = spanToJSON(activeRootSpan).data || {}
255-
if (existingAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== 'custom') {
256-
activeRootSpan.updateName(transactionName)
257-
activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, transactionSource)
258-
}
251+
// Replace the name of the existing root span
252+
activeRootSpan.updateName(transactionName)
259253

260254
// Set router attributes on the existing pageload transaction
261-
// This will override the origin and add params & query attributes
255+
// This will override the source and origin and add params & query attributes
262256
activeRootSpan.setAttributes({
263257
...attributes,
258+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: transactionSource,
264259
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue',
265260
})
266261

@@ -294,14 +289,5 @@ function browserTracingIntegration(router: Router): Integration {
294289

295290
function getActiveRootSpan(): Span | undefined {
296291
const span = getActiveSpan()
297-
const rootSpan = span && getRootSpan(span)
298-
299-
if (!rootSpan) {
300-
return undefined
301-
}
302-
303-
const op = spanToJSON(rootSpan).op
304-
305-
// Only use this root span if it is a pageload or navigation span
306-
return op === 'navigation' || op === 'pageload' ? rootSpan : undefined
292+
if (span) return getRootSpan(span)
307293
}

website/src/router/guards.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ export function homeGuard(): NavigationGuardReturn {
1010
const { entityType } = useSettingsStore()
1111

1212
// Redirect the user either to the timetable or welcome page
13-
if (entityType === EntityType.None) return { name: 'welcome', replace: true }
14-
else return { name: 'timetable', replace: true }
13+
if (entityType === EntityType.None) return { name: 'welcome', replace: true, force: true }
14+
else return { name: 'timetable', replace: true, force: true }
1515
}
1616

1717
export function welcomeGuard(): NavigationGuardReturn {
1818
const { entityType } = useSettingsStore()
1919

2020
// Redirect the user to the timetable page if it has the entity set
21-
if (entityType !== EntityType.None) return { name: 'timetable', replace: true }
21+
if (entityType !== EntityType.None) return { name: 'timetable', replace: true, force: true }
2222
}
2323

2424
export async function timetableGuard(

0 commit comments

Comments
 (0)