Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hotwax/launchpad into launc…
Browse files Browse the repository at this point in the history
…hpad/#70
  • Loading branch information
k2maan committed Nov 10, 2023
2 parents e06cff4 + 975ae77 commit 8099f4d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"projects": {
"dev": "hotwax-digital-commerce",
"default": "digital-commerce-71eb8",
"default": "hotwax-digital-commerce",
"production": "digital-commerce-71eb8"
},
"targets": {
"digital-commerce-71eb8": {
"hosting": {
"hotwax-launchpad": [
"prod": [
"hotwax-launchpad"
]
}
},
"hotwax-digital-commerce": {
"hosting": {
"hotwax-launchpad-dev": [
"dev": [
"hotwax-launchpad-dev"
]
}
Expand Down
27 changes: 7 additions & 20 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,10 @@ name: Deploy to Firebase Hosting on merge
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: npm install
- name: Generate .env file
run: cp .env.example .env
- name: Build
run: npm run build
- name: Install Firebase
run: npm install -g firebase-tools
- name: Set Firebase project
run: firebase use default --token "$HOTWAX_PUBLIC_SECRET"
env:
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
- name: Deploy
run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:hotwax-launchpad
env:
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
call-workflow-in-another-repo:
uses: hotwax/dxp-components/.github/workflows/common-firebase-hosting-merge.yml@main
with:
config-path: .github/labeler.yml
secrets:
envPAT: ${{ secrets.envPAT }}
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
4 changes: 2 additions & 2 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"hosting": [
{
"target": "hotwax-launchpad",
"target": "prod",
"public": "dist",
"ignore": [
"firebase.json",
Expand All @@ -15,7 +15,7 @@

},
{
"target": "hotwax-launchpad-dev",
"target": "dev",
"public": "dist",
"ignore": [
"firebase.json",
Expand Down
2 changes: 1 addition & 1 deletion src/store/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useAuthStore = defineStore('authStore', {
const currTime = DateTime.now().toMillis();
isTokenExpired = state.token.expiration < currTime;
}
return state.token.value && !isTokenExpired;
return !!(state.token.value && !isTokenExpired);
},
getOMS: (state) => state.oms,
getBaseUrl: (state) => {
Expand Down
34 changes: 25 additions & 9 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<ion-page>
<ion-content>

<header>
<h1 class="title">
{{ $t('Launch Pad') }}
Expand All @@ -25,17 +24,17 @@
<div class="type" v-for="category in Object.keys(appCategory)" :key="category">
<h3>{{ category }}</h3>
<div class="apps">
<ion-card class="app" v-for="app in appCategory[category]" :key="app.handle" :href="scheme + app.handle + domain + (Object.keys(authStore.current).length ? `/login?oms=${authStore.getOMS}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}` : '')">
<ion-card button class="app" v-for="app in appCategory[category]" :key="app.handle" :href="scheme + app.handle + domain + (authStore.isAuthenticated ? `/login?oms=${authStore.getOMS}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}` : '')">
<div class="app-icon ion-padding">
<img :src="app.resource" />
</div>
<ion-card-header class="app-content">
<ion-card-title color="text-medium">{{ app.name }}</ion-card-title>
<ion-buttons class="app-links">
<ion-button color="medium" :href="scheme + app.handle + devHandle + domain + (Object.keys(authStore.current).length ? `/login?oms=${authStore.getOMS}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}` : '')">
<ion-button color="medium" :href="scheme + app.handle + devHandle + domain + (authStore.isAuthenticated ? `/login?oms=${authStore.getOMS}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}` : '')">
<ion-icon slot="icon-only" :icon="codeWorkingOutline" />
</ion-button>
<ion-button color="medium" :href="scheme + app.handle + uatHandle + domain + (Object.keys(authStore.current).length ? `/login?oms=${authStore.getOMS}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}` : '')">
<ion-button color="medium" :href="scheme + app.handle + uatHandle + domain + (authStore.isAuthenticated ? `/login?oms=${authStore.getOMS}&token=${authStore.token.value}&expirationTime=${authStore.token.expiration}` : '')">
<ion-icon slot="icon-only" :icon="shieldHalfOutline" />
</ion-button>
</ion-buttons>
Expand Down Expand Up @@ -65,9 +64,9 @@ import { defineComponent, ref } from 'vue';
import {
codeWorkingOutline,
lockClosedOutline,
personCircleOutline,
rocketOutline,
shieldHalfOutline,
personCircleOutline
shieldHalfOutline
} from 'ionicons/icons';
import { useAuthStore } from '@/store/auth';
import { useRouter } from "vue-router";
Expand All @@ -91,6 +90,26 @@ export default defineComponent({
// if the user navigates to the home page while login
this.authStore.setRedirectUrl('')
},
methods: {
login() {
// hydrate (pinia-plugin-persistedstate) will sync the app state with the
// localStorage state for avoiding the case when two launchpad tabs are opened
// and the user logs in through one and tries to login again from the next tab
// $hydate will resync the state and hence, update the app UI
this.authStore.$hydrate({ runHooks: false })
// push to login only if user is not logged in (after state hydration)
if (!this.authStore.isAuthenticated) {
this.router.push('/login')
}
},
async logout() {
this.authStore.$hydrate({ runHooks: false })
// hydrate and logout only if user is logged in (authenticated)
if (this.authStore.isAuthenticated) {
await this.authStore.logout()
}
}
},
setup() {
const authStore = useAuthStore();
const router = useRouter();
Expand Down Expand Up @@ -237,9 +256,6 @@ export default defineComponent({
object-fit: cover;
}
.app-content {
}
ion-card {
border-radius: 40px;
transition: .4s cubic-bezier(0.59, 0.08, 0.05, 1.4);
Expand Down

0 comments on commit 8099f4d

Please sign in to comment.