-
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.
Add a tag to the Changelog menu item and a sparkle icon to the user a…
…vatar when a new version of TrackBear is deployed
- Loading branch information
1 parent
68095bc
commit 6e6a85b
Showing
9 changed files
with
178 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// These need to be written out here because otherwise Tailwind will exclude them when building | ||
|
||
export const TEXT = { | ||
primary: 'text-primary-500 dark:text-primary-400', | ||
accent: 'text-accent-500 dark:text-accent-400', | ||
// TODO: secondary, danger, warning, info, success, error | ||
}; | ||
|
||
export const BACKGROUND = { | ||
primary: 'bg-primary-500 dark:bg-primary-400', | ||
accent: 'bg-accent-500 dark:bg-accent-400', | ||
// TODO: secondary, danger, warning, info, success, error | ||
}; | ||
|
||
export default { | ||
TEXT, | ||
BACKGROUND, | ||
}; |
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,40 @@ | ||
import packageJson from '../../package.json' assert { type: 'json' }; | ||
import { useLocalStorage } from '@vueuse/core'; | ||
|
||
import { Changelog } from 'server/lib/parse-changelog.ts'; | ||
|
||
export function useLastChangelogViewed() { | ||
return useLocalStorage('last-changelog-viewed', '0.0.0'); | ||
} | ||
|
||
export function getCurrentVersion() { | ||
return packageJson.version; | ||
} | ||
|
||
export function findLatestChangelogVersion(changelog: Changelog) { | ||
const versions = changelog | ||
.map(c => c.version) | ||
.filter(v => /\d+\.\d+\.\d+/.test(v)) | ||
.sort(cmpVersion) | ||
.reverse(); | ||
|
||
return versions.length >= 1 ? versions[0] : '0.0.0'; | ||
} | ||
|
||
export function cmpVersion(a: string, b: string) { | ||
const aParts = a.split('.').map(x => +x); | ||
const bParts = b.split('.').map(x => +x); | ||
if(aParts.length !== bParts.length) { | ||
throw new Error(`Cannot compare ${a} and ${b}; they do not have the same number of parts`); | ||
} | ||
|
||
for(let i = 0; i < aParts.length; ++i) { | ||
if(aParts[i] < bParts[i]) { | ||
return -1; | ||
} else if(aParts[i] > bParts[i]) { | ||
return 1; | ||
} // else, on to the next dot down | ||
} | ||
|
||
return 0; | ||
} |
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