-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(pages): update request create route * refactor: move data source func to data-source store * feat: data source create route also updates search typeahead just slightly * fix: final removal of typeahead caching * fix: update data source id route * fix: update location typeahead * refactor: little improvements to request and search * refactor: data source create * chore(deps): add vue3-toastify * feat: add toast messages with vue3-toastify * feat: add toast to create routes
- Loading branch information
1 parent
14eda58
commit b7a4f28
Showing
15 changed files
with
647 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { onMounted } from 'vue'; | ||
|
||
/** Sets theme as class to document.documentElement | ||
* This is only necessary because `vue3-toastify` expects global themes to be set this way. | ||
* 🙄 https://github.com/jerrywu001/vue3-toastify/blob/96706e8399c336bd1d8c458cf872b6df395352a0/src/utils/tools.ts#L60-L62*/ | ||
export default function useThemePreference() { | ||
const applyTheme = (newTheme) => { | ||
// Remove any existing theme classes | ||
document.documentElement.classList.remove('light', 'dark'); | ||
// Add the new theme class | ||
document.documentElement.classList.add(newTheme); | ||
}; | ||
|
||
const initializeTheme = () => { | ||
// Check system preference | ||
const prefersDark = window.matchMedia( | ||
'(prefers-color-scheme: dark)', | ||
).matches; | ||
applyTheme(prefersDark ? 'dark' : 'light'); | ||
}; | ||
|
||
// Watch for system theme changes | ||
const setupThemeListener = () => { | ||
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); | ||
|
||
mediaQuery.addEventListener('change', (e) => { | ||
const newTheme = e.matches ? 'dark' : 'light'; | ||
// Only apply system preference if no stored preference exists | ||
if (!localStorage.getItem('theme')) { | ||
applyTheme(newTheme); | ||
} | ||
}); | ||
}; | ||
|
||
onMounted(() => { | ||
initializeTheme(); | ||
setupThemeListener(); | ||
}); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.