Skip to content

Commit

Permalink
Merge pull request #104 from filips123/frontend-fixes
Browse files Browse the repository at this point in the history
More fixes for the new frontend
  • Loading branch information
filips123 authored Sep 8, 2024
2 parents 91f1ad2 + 568bcfd commit 8c64ed7
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: Napaka v delovanju
description: Napišite poročilo o napaki v delovanju.
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Hvala, ker ste si vzeli čas za izpolnitev tega poročila!
value: Hvala, ker ste si vzeli čas za izpolnjevanje tega poročila!
- type: textarea
id: description
attributes:
label: Opis napake
description: Kolikor vam je mogoče podrobno opisati napako.
description: Čim bolj podrobno opišite napako, ki ste jo opazili.
validations:
required: true
- type: input
id: os
attributes:
label: Operacijski sistem
description: V katerem operacijskem sistemu se pojavlja ta napaka (po možnosti z verzijo)?
placeholder: Android 13, iOS 16, Windows 11 itd.
placeholder: npr. Android 14, iOS 17.6, Windows 11, itd.
validations:
required: true
- type: input
id: browser
attributes:
label: Brskalnik
description: V katerem brskalniku se pojavlja ta napaka?
placeholder: Chrome, Safari, Firefox itd.
description: V katerem brskalniku se pojavlja ta napaka (po možnosti z verzijo)?
placeholder: npr. Chrome 128, Firefox 130, Safari 17.6, itd.
validations:
required: true
- type: textarea
id: screenshot
attributes:
label: Posnetek zaslona telefona/računalnika
description: V primeru, če imate vizualne napake, lahko tu prilepite svoj posnetek zaslona.
label: Posnetek zaslona
description: V primeru, da imate vizualne napake, lahko tu prilepite svoj posnetek zaslona.
placeholder: Kliknite v to besedilno polje in prilepite svoj posnetek zaslona.
validations:
required: false
required: false
34 changes: 21 additions & 13 deletions .github/ISSUE_TEMPLATE/data_error.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
name: Napaka v podatkih
description: Napišite poročilo o napaki v podatkih.
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Hvala, ker ste si vzeli čas za izpolnitev tega poročila!
value: Hvala, ker ste si vzeli čas za izpolnjevanje tega poročila!
- type: dropdown
id: datatype
attributes:
label: Vrsta podatka
description: Pri katerem podatku, se je pojavila napaka?
description: Pri katerem podatku se je pojavila napaka?
options:
- Urnik
- Jedilniki
- Okrožnice
- Nadomeščanja
- Okrožnice
- Jedilniki
- Razporedi kosil
validations:
required: true
- type: dropdown
id: viewtype
attributes:
label: Vrsta pogleda
description: Pri katerem pogledu, se je pojavila napaka?
description: Pri katerem pogledu se je pojavila napaka?
options:
- Razred
- Profesor
- Učilnica
validations:
required: true
required: false
- type: input
id: viewlist
attributes:
label: Ime pogleda
description: Pri katerem pogledu se je pojavila napaka?
placeholder: npr. 4A, MINF, MZGO
validations:
required: false
- type: textarea
id: error
id: description
attributes:
label: Opis napake
description: Kolikor vam je mogoče podrobno opisati napako.
placeholder: npr. Namesto geografije 3. uro je bila napisana 4. uro
description: Čim bolj podrobno opišite napako, ki ste jo opazili.
placeholder: npr. Namesto geografije 3. uro je bila napisana kemija.
validations:
required: true
- type: input
id: date
attributes:
label: Datum
description: Vpišite datum, ko se je zgodila napaka (dd. mm. yyyy)
placeholder: npr. 29. 12. 2023
description: Vnesite datum, ko se je zgodila napaka (dd. mm. yyyy).
placeholder: npr. 27. 5. 2024
validations:
required: false
required: false
20 changes: 10 additions & 10 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: Prošnja za funkcijo
description: Napišite izboljšavo obstoječih funkcij ali novo funkcijo
description: Napišite predlog za izboljšavo obstoječih funkcij ali dodajanja novih.
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Hvala, ker ste si vzeli čas za izpolnitev tega poročila!
value: Hvala, ker ste si vzeli čas za izpolnjevanje tega poročila!
- type: textarea
id: idea
id: description
attributes:
label: Vaša zamisel
description: V nekaj stavkih opišite svojo zamisel.
validations:
required: true
- type: textarea
id: whatfor
id: problem
attributes:
label: Problem, ki ga reši
label: Rešen problem
description: Kakšen problem bi rešila vaša zamisel?
validations:
required: true
- type: textarea
id: other
id: context
attributes:
label: Slike vaše zamisli
description: Kako bi izgledala vaša zamisel? Kako rešijo to druge aplikacije?
label: Več informacij
description: Kako bi izgledala vaša zamisel? Kako to rešujejo druge aplikacije?
validations:
required: false
required: false
6 changes: 6 additions & 0 deletions website/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import AppSnackbar from '@/components/AppSnackbar.vue'
import NavigationDay from '@/components/NavigationDay.vue'
import NavigationDesktop from '@/components/NavigationDesktop.vue'
import NavigationMobile from '@/components/NavigationMobile.vue'
import { useSnackbarStore } from '@/composables/snackbar'
import { useSessionStore } from '@/stores/session'
import { ThemeType, useSettingsStore } from '@/stores/settings'
import { updateAllData } from '@/utils/update'
Expand Down Expand Up @@ -50,6 +51,11 @@ onMounted(() => {
updateAllData()
},
})
if (!navigator.onLine) {
const { displaySnackbar } = useSnackbarStore()
displaySnackbar('Internetna povezava ni na voljo')
}
})
onUnmounted(() => {
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/SettingsSelectEntity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const availableList = computed(() => {
// Display the correct dialogs based on state
useEventListener(window, 'popstate', event => {
if (event.state?.entityTypeDialog && event.state?.entityListDialog) {
if (event.state?.entityTypeDialog || event.state?.entityListDialog) {
entityTypeDialog.value = event.state.entityTypeDialog
entityListDialog.value = event.state.entityListDialog
}
Expand Down
19 changes: 16 additions & 3 deletions website/src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ export default function registerServiceWorker(router: Router) {
// Display a message while updating the service worker
const { displaySnackbar } = useSnackbarStore()
displaySnackbar('Posodabljanje ...')

// Mark that we need to update the service worker
immediatelyUpdate = true
}

if (searchParams.has('updating')) {
// Display a success message if the app was updated
const { displaySnackbar } = useSnackbarStore()
displaySnackbar('Aplikacija posodobljena')

// Hide the parameter after the app was updated
router.replace(location.pathname)
}

Expand All @@ -40,20 +44,29 @@ export default function registerServiceWorker(router: Router) {

onNeedRefresh() {
if (immediatelyUpdate) {
// Update the service worker immediately if requested
console.log('Update parameter detected, updating the service worker...')

// Update the service worker immediately if requested
performUpdate()
} else {
// Prompt the user to update the service worker
console.log('New content is available, prompting the user to refresh...')

// Prompt the user to update the service worker
const { displaySnackbar } = useSnackbarStore()
displaySnackbar('Na voljo je posodobitev', 'Posodobi', performUpdate, -1)
}
},
})

const performUpdate = async () => {
await router.replace({ path: location.pathname, query: { updating: 1 } })
// Display a message while updating the service worker
const { displaySnackbar } = useSnackbarStore()
displaySnackbar('Posodabljanje ...')

// Add query parameter so we know the app was updated
history.replaceState(history.state, '', location.pathname + '?updating=1')

// Update the service worker
await updateSW()
}
}
7 changes: 4 additions & 3 deletions website/src/utils/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ export async function updateAllData(showSuccess: boolean = true): Promise<void>
}

export async function updateWrapper(updateFunction: () => Promise<void>) {
const { displaySnackbar } = useSnackbarStore()

if (!navigator.onLine) {
displaySnackbar('Internetna povezava ni na voljo')
return
}

try {
await updateFunction()
} catch (error) {
// Inform the user about the error
const { displaySnackbar } = useSnackbarStore()
displaySnackbar('Napaka pri pridobivanju podatkov')

// Log the error to the console
console.error(error)

// Submit the error to Sentry if enabled
Expand Down

0 comments on commit 8c64ed7

Please sign in to comment.