Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ declare module 'vue' {
VoAuthGithub: typeof import('./components/auth/VoAuthGithub.vue')['default']
VoAuthListItem: typeof import('./components/auth/VoAuthListItem.vue')['default']
VoAuthLogoutNavItem: typeof import('./components/auth/VoAuthLogoutNavItem.vue')['default']
VoAuthOpenCollective: typeof import('./components/auth/VoAuthOpenCollective.vue')['default']
VoAuthShopify: typeof import('./components/auth/VoAuthShopify.vue')['default']
VoBtn: typeof import('./components/app/VoBtn.vue')['default']
VoCard: typeof import('./components/app/VoCard.vue')['default']
Expand Down Expand Up @@ -59,6 +60,7 @@ declare module 'vue' {
VoSponsorshipsTimelineItemDiscord: typeof import('./components/sponsorships/VoSponsorshipsTimelineItemDiscord.vue')['default']
VoSponsorshipsTimelineItemGithub: typeof import('./components/sponsorships/VoSponsorshipsTimelineItemGithub.vue')['default']
VoSponsorshipsTimelineItemOne: typeof import('./components/sponsorships/VoSponsorshipsTimelineItemOne.vue')['default']
VoSponsorshipsTimelineItemOpencollective: typeof import('./components/sponsorships/VoSponsorshipsTimelineItemOpencollective.vue')['default']
VoSpot: typeof import('./components/spots/VoSpot.vue')['default']
VoSubscriptionDialog: typeof import('./components/subscription/VoSubscriptionDialog.vue')['default']
VoSubscriptionInvoices: typeof import('./components/subscription/VoSubscriptionInvoices.vue')['default']
Expand Down
6 changes: 4 additions & 2 deletions src/components/auth/VoAuthCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@

<VoAuthDiscord class="mb-3" />

<VoAuthShopify />
<VoAuthShopify class="mb-3" />

<VoAuthOpenCollective />
</v-list>
</v-card>
</template>

<script setup lang="ts">
<script lang="ts" setup>
const auth = useAuthStore()
</script>
4 changes: 3 additions & 1 deletion src/components/auth/VoAuthListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<VoAuthDiscord @click="social = false" />

<VoAuthShopify @click="social = false" />

<VoAuthOpenCollective @click="social = false" />
</div>
</v-sheet>
</v-expand-transition>
Expand All @@ -54,7 +56,7 @@
</template>

<script lang="ts" setup>
// Icons
// Icons
import { mdiSync, mdiSyncOff } from '@mdi/js'

const auth = useAuthStore()
Expand Down
38 changes: 38 additions & 0 deletions src/components/auth/VoAuthOpenCollective.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<v-list-item
base-color="#1258e2"
:prepend-icon="`svg:${mdiAccountGroupOutline}`"
rounded="pill"
slim
variant="flat"
@click="auth.login('opencollective')"
>
<template #title>
<span class="text-body-2">{{ text }}</span>
</template>

<template
v-if="(!auth.user && auth.lastLoginProvider() === 'openCollective')"
#subtitle
>
<div class="text-caption mt-n1">Last Used</div>
</template>
</v-list-item>
</template>

<script lang="ts" setup>
import { mdiAccountGroupOutline } from '@mdi/js'

const auth = useAuthStore()

const hasIdentity = computed(() => {
return auth.user && auth.findIdentity('opencollective')
})

const text = computed(() => {
if (!auth.user) return 'Login with Open Collective'
if (hasIdentity.value) return 'Connected to Open Collective'

return 'Connect Open Collective'
})
</script>
4 changes: 3 additions & 1 deletion src/components/sponsorships/VoSponsorshipsTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<VoSponsorshipsTimelineItemGithub />

<VoSponsorshipsTimelineItemDiscord />

<VoSponsorshipsTimelineItemOpencollective />
</v-timeline>
</template>

<script lang="ts" setup>
//
//
</script>
3 changes: 1 addition & 2 deletions src/components/sponsorships/VoSponsorshipsTimelineItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</template>

<script lang="ts" setup>
// Types
// Types
import type { VOneSponsorship } from '@/stores/auth'

// Icons
Expand All @@ -75,7 +75,6 @@

const tier = computed(() => {
const amount = Number.parseFloat(String((props.sponsorship?.amount ?? 0) / 100)).toFixed(2)

return `$${amount} /${props.sponsorship?.interval}`
})
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<VoSponsorshipsTimelineItem
href="https://opencollective.com/vuetify"
logo="opencollective"
:sponsorship="one.opencollective"
text="Support Vuetify through Open Collective."
title="Open Collective Subscriber"
/>
</template>

<script lang="ts" setup>
const one = useOneStore()
</script>
4 changes: 2 additions & 2 deletions src/stores/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface AuthState {
isLoading: ShallowRef<boolean>
verify: (force?: boolean) => Promise<void>
findIdentity: (provider: string) => VOneIdentity | undefined
login: (provider?: 'github' | 'discord' | 'shopify') => Promise<void>
login: (provider?: 'github' | 'discord' | 'shopify' | 'opencollective') => Promise<void>
logout: (identity?: string) => Promise<void>
lastLoginProvider: () => string | null
sync: () => Promise<void>
Expand Down Expand Up @@ -141,7 +141,7 @@ export const useAuthStore = defineStore('auth', (): AuthState => {

verify.promise = null as Promise<void> | null

async function login (provider: 'github' | 'discord' | 'shopify' = 'github') {
async function login (provider: 'github' | 'discord' | 'shopify' | 'opencollective' = 'github') {
isLoading.value = true

const redirectUrl = `${http.url}/auth/${provider}/redirect`
Expand Down
5 changes: 5 additions & 0 deletions src/stores/one.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ interface OneState {
github: ComputedRef<VOneSponsorship | undefined>
discord: ComputedRef<VOneSponsorship | undefined>
shopify: ComputedRef<VOneIdentity | undefined>
opencollective: ComputedRef<VOneSponsorship | undefined>
one: ComputedRef<VOneSponsorship | undefined>

activate: () => Promise<void>
Expand Down Expand Up @@ -107,6 +108,9 @@ export const useOneStore = defineStore('one', (): OneState => {
const discord = computed(() => {
return auth.user?.sponsorships.find(s => s.platform === 'discord' && s.isActive)
})
const opencollective = computed(() => {
return auth.user?.sponsorships.find(s => s.platform === 'opencollective' && s.isActive)
})
const shopify = computed(() => {
return auth.user?.identities.find(i => i.provider === 'shopify')
})
Expand Down Expand Up @@ -259,6 +263,7 @@ export const useOneStore = defineStore('one', (): OneState => {
isOpen,
isSubscriber,

opencollective,
github,
discord,
shopify,
Expand Down