Skip to content

Commit

Permalink
Merge pull request #1216 from geoadmin/feat-PB-1031-add-github-link-t…
Browse files Browse the repository at this point in the history
…o-release

PB-1031: redirect github link to release page
  • Loading branch information
ltkum authored Jan 28, 2025
2 parents f28ff91 + 450c91f commit 1658eeb
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/utils/components/AppVersion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ import { useStore } from 'vuex'
import { APP_VERSION } from '@/config/staging.config'
import { GITHUB_REPOSITORY } from '@/config/staging.config'
const cleanAppVersionRegex = /v\d+\.\d+\.\d+$/
const store = useStore()
const appVersion = ref(APP_VERSION)
const isProd = computed(() => store.getters.isProductionSite)
function openGithubLink() {
function openGithubReleaseLink() {
const isAppVersionClean = appVersion.value.match(cleanAppVersionRegex)
if (!isAppVersionClean) {
openGithubRepoLink()
} else {
window.open(GITHUB_REPOSITORY + `/releases/tag/` + APP_VERSION, '_blank')
}
}
function openGithubRepoLink() {
window.open(GITHUB_REPOSITORY, '_blank')
}
</script>

<template>
<div
class="app-version"
:class="{ 'app-version-prod': isProd }"
data-cy="app-version"
@click="openGithubLink"
>
<font-awesome-icon :icon="['fab', 'github']" />
{{ appVersion }}
<div class="app-version" :class="{ 'app-version-prod': isProd }" data-cy="app-version">
<span @click="openGithubRepoLink" class="githubIcon"
><font-awesome-icon :icon="['fab', 'github']"
/></span>
<span class="app-version-link" @click="openGithubReleaseLink"> {{ appVersion }}</span>
</div>
</template>

Expand All @@ -35,7 +41,16 @@ function openGithubLink() {
cursor: pointer;
}
.app-version-link {
margin-left: 3px;
}
.githubIcon {
margin-right: 3px;
}
.app-version-prod {
color: $gray-500;
cursor: pointer;
}
</style>

0 comments on commit 1658eeb

Please sign in to comment.