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

fix pro tag display #311

Merged
merged 1 commit into from
Feb 6, 2024
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
55 changes: 12 additions & 43 deletions client/components/global/ProTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,49 +36,18 @@
</div>
</template>

<script>
<script setup>
import { computed } from 'vue'
import Modal from './Modal.vue'
import { useAuthStore } from '../../stores/auth';
import { useWorkspacesStore } from '../../stores/workspaces';
import PricingTable from "../pages/pricing/PricingTable.vue";

export default {
name: 'ProTag',
components: {PricingTable, Modal},
props: {},

setup () {
const authStore = useAuthStore()
const workspacesStore = useWorkspacesStore()
return {
user : computed(() => authStore.user),
currentWorkSpace : computed(() => workspacesStore.getCurrent())
}
},

data() {
return {
showPremiumModal: false,
checkoutLoading: false
}
},

computed: {
shouldDisplayProTag() {
if (!this.$config.paid_plans_enabled) return false
if (!this.user || !this.currentWorkSpace) return true
return !(this.currentWorkSpace.is_pro)
},
},

mounted() {
},

methods: {
openChat() {
useCrisp().openAndShowChat()
},
}
}
const authStore = useAuthStore()
const workspacesStore = useWorkspacesStore()
const user = computed(() => authStore.user)
const workspace = computed(() => workspacesStore.getCurrent)
const showPremiumModal = ref(false)

const shouldDisplayProTag = computed(() => {
if (!useRuntimeConfig().public.paidPlansEnabled) return false
if (!user.value || !workspace.value) return true
return !(workspace.value.is_pro)
})
Comment on lines +39 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The computed property shouldDisplayProTag returns true when !user.value || !workspace.value, which seems counterintuitive. If there's no user or workspace, it might be more logical to not display the ProTag, unless this behavior is explicitly intended.

Consider revising the logic to ensure it aligns with the intended behavior for when user or workspace information is missing.

</script>
Comment on lines 36 to 53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-33]

Ensure accessibility by adding role="button" to the div acting as a button and providing a meaningful aria-label for better screen reader support.

<div class="bg-nt-blue text-white px-2 text-xs uppercase inline rounded-full font-semibold cursor-pointer"
+    role="button"
+    aria-label="Show premium options"
     @click.prevent="showPremiumModal=true"
>

Loading