Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-1031: redirect github link to release page #1216

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading