Skip to content

Commit

Permalink
Merge pull request #232 from KenEucker/develop
Browse files Browse the repository at this point in the history
2.0.0
  • Loading branch information
KenEucker committed Jan 9, 2024
2 parents 3cb7fcd + f019b61 commit 76f4089
Show file tree
Hide file tree
Showing 17 changed files with 220 additions and 214 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Below you will find some of the primary settings for testing all features of the
```sh
#.env
# Used for internal authentication
SUPER_ADMIN[email protected]
ADMIN_EMAIL[email protected]
HOST_KEY=anythingyouwantititobe
ACCESS_TOKEN=BIKETAGACCESSTOKEN
# Used for uploading new BikeTag posts
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"module": "./biketag-vue.es.js",
"exports": {
".": {
"import": "./biketag-vue.es.js"
"import": "./biketag-vue.es.js",
"types": "./index.d.ts"
},
"./biketag-vue.css": {
"import": "./biketag-vue.css"
Expand Down
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ function checkForNewBikeTagPost() {
async function created() {
const initResults = []
/// Set it first thing
store.SET_DATA_INITIALIZED()
const game = await store.setGame()
const _gameIsSet = game?.name?.length !== 0
Expand Down
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import VueCookies from 'vue3-cookies'
import App from './App.vue'
import { dynamicFontDirective } from './directives'
import router from './router'
import { store } from './store'
import { biketagStore } from './store'

// eslint-disable-next-line
// @ts-ignore
Expand Down Expand Up @@ -50,7 +50,7 @@ class BikeTagApp {
this.app.use(VueCookies)
}
router() {
this.app.use(router).use(store)
this.app.use(router).use(biketagStore)
}
authentication() {
if (isAuthenticationEnabled()) {
Expand Down
47 changes: 47 additions & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export const BikeTagDefaults = {
appId: 'com.app.biketag',
accessToken: '8b4e2b86a724bf3f39d6766de6e67212',
admingEmail: '[email protected]',
gameName: '',
host: 'biketag.org',
hostKey: 'ItsABikeTagGame',
source: 'sanity',
logo: '/images/BikeTag.svg',
jingle: 'media/biketag-jingle-1.mp3',
store: 'biketag',
manifest: {
name: 'BikeTag',
shortName: 'BikeTag',
description: 'BikeTag is a photo mystery tag game played on bicycles. No login required.',
themeColor: '#000000',
},
/// TODO: THIS IS BAD
sanityImagesCDNUrl: 'https://cdn.sanity.io/images/',
sanityBaseCDNUrl: 'https://cdn.sanity.io/images/x37ikhvs/production/',
sanityPlayerRoleID: 'rol_pcbQ68Q9L0yn1o3O',
sanityAmbassadorRoleID: 'rol_iET51vzIn8z6Utz0',
}

export const special = [
'zeroth',
'first',
'second',
'third',
'fourth',
'fifth',
'sixth',
'seventh',
'eighth',
'ninth',
'tenth',
'eleventh',
'twelfth',
'thirteenth',
'fourteenth',
'fifteenth',
'sixteenth',
'seventeenth',
'eighteenth',
'nineteenth',
]
export const deca = ['twent', 'thirt', 'fort', 'fift', 'sixt', 'sevent', 'eight', 'ninet']
1 change: 1 addition & 0 deletions src/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './constants'
export * from './types'
export * from './utils'
export * from './uuid'
Expand Down
55 changes: 14 additions & 41 deletions src/common/types.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,21 @@
import { Achievement, Game, Player, Tag } from 'biketag/lib/common/schema'
import {
Achievement,
Ambassador,
Game,
Player,
Region,
Setting,
Tag,
} from 'biketag/lib/common/schema'

export type { Achievement, Game, Player, Tag }
export type { Achievement, Ambassador, Game, Player, Region, Setting, Tag }

export type DomainInfo = {
host: string
subdomain: string | undefined
isSubdomain: boolean
}

export const BikeTagDefaults = {
gameName: '',
source: 'sanity',
logo: '/images/BikeTag.svg',
jingle: 'media/biketag-jingle-1.mp3',
store: 'biketag',
/// TODO: THIS IS BAD
sanityBaseCDNUrl: 'https://cdn.sanity.io/images/x37ikhvs/production/',
}

export const special = [
'zeroth',
'first',
'second',
'third',
'fourth',
'fifth',
'sixth',
'seventh',
'eighth',
'ninth',
'tenth',
'eleventh',
'twelfth',
'thirteenth',
'fourteenth',
'fifteenth',
'sixteenth',
'seventeenth',
'eighteenth',
'nineteenth',
]
export const deca = ['twent', 'thirt', 'fort', 'fift', 'sixt', 'sevent', 'eight', 'ninet']

export interface ProfileMeta {
name: string
passcode: string
Expand All @@ -56,7 +30,6 @@ export interface ProfileMeta {
skipSteps: boolean
}
}

export interface AmbassadorMeta extends ProfileMeta {
credentials: {
imgur: {
Expand Down Expand Up @@ -99,7 +72,7 @@ export interface AmbassadorProfile extends Profile {
zipcode: string
}
export type BikeTagProfile = Partial<Profile> & Partial<AmbassadorProfile>
export interface State {
export interface BikeTagStoreState {
dataInitialized: boolean
game: Game
allGames: Game[]
Expand All @@ -116,11 +89,11 @@ export interface State {
formStep: number
playerTag: Tag
credentialsFetched: boolean
mostRecentlyViewedTagnumber: BiketagFormSteps
mostRecentlyViewedTagnumber: BiketagQueueFormSteps
regionPolyon: any
}

export enum BiketagFormSteps {
export enum BiketagQueueFormSteps {
viewRound = 0.5,
addFoundImage = 1,
roundJoined = 1.5,
Expand All @@ -130,7 +103,7 @@ export enum BiketagFormSteps {
shareBikeTagPost = 3.5,
}

export enum Settings {
export enum BikeTagSettingsKeys {
AutoPost = 'queue::autoPost',
Jingle = 'easter::jingle',
SupportsReddit = 'social::reddit',
Expand Down
14 changes: 7 additions & 7 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { useCookies } from 'vue3-cookies'
import {
BikeTagDefaults,
BikeTagProfile,
BiketagFormSteps,
BiketagQueueFormSteps,
DomainInfo,
deca,
special,
} from '../../src/common/types'
} from '../../src/common'

export const stringifyNumber = (n: number): string => {
if (n < 20) return special[n]
Expand Down Expand Up @@ -263,16 +263,16 @@ export const GetQueryString = (win: Window, name: string): string | null => {
return null
}

export const getQueuedTagState = (queuedTag: Tag): BiketagFormSteps => {
export const getQueuedTagState = (queuedTag: Tag): BiketagQueueFormSteps => {
const mysteryImageSet = queuedTag.mysteryImageUrl?.length > 0
const foundImageSet = queuedTag.foundImageUrl?.length > 0
let queuedTagState = BiketagFormSteps.addFoundImage
let queuedTagState = BiketagQueueFormSteps.addFoundImage
if (mysteryImageSet && foundImageSet) {
queuedTagState = BiketagFormSteps.roundPosted
queuedTagState = BiketagQueueFormSteps.roundPosted
} else {
queuedTagState = foundImageSet
? BiketagFormSteps.addMysteryImage
: BiketagFormSteps.addFoundImage
? BiketagQueueFormSteps.addMysteryImage
: BiketagQueueFormSteps.addFoundImage
}

return queuedTagState
Expand Down
4 changes: 2 additions & 2 deletions src/components/BikeTagQueue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
import { inject, computed, nextTick } from 'vue'
import { useRouter } from 'vue-router'
import { useBikeTagStore } from '../store/index'
import { BiketagFormSteps } from '../common/types'
import { BiketagQueueFormSteps } from '../common/types'
import { useI18n } from 'vue-i18n'
import VLazyImage from 'v-lazy-image'
Expand Down Expand Up @@ -137,7 +137,7 @@ const showNumber = computed(() => (props.size !== 's' ? props.showNumber : false
// methods
function canReset() {
return getQueuedTagState.value !== BiketagFormSteps.roundPosted
return getQueuedTagState.value !== BiketagQueueFormSteps.roundPosted
}
async function resetToFound() {
await store.fetchCredentials()
Expand Down
2 changes: 1 addition & 1 deletion src/components/QueuePostedShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
import { ref, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { useBikeTagStore } from '@/store/index'
import { Settings } from '@/common/types'
import { BikeTagSettingsKeys } from '@/common/types'
// components
import Markdown from 'vue3-markdown-it'
Expand Down
8 changes: 4 additions & 4 deletions src/components/QueueSubmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<script setup name="QueueSubmit">
import { ref, computed, onMounted } from 'vue'
import { useBikeTagStore } from '@/store/index'
import { Settings } from '@/common/types'
import { BikeTagSettingsKeys } from '@/common/types'
// components
import Markdown from 'vue3-markdown-it'
Expand All @@ -136,9 +136,9 @@ const getCurrentBikeTag = computed(() => store.getCurrentBikeTag)
const getPlayerId = computed(() => store.getPlayerId)
const getGameNameProper = computed(() => store.getGameNameProper)
const getGame = computed(() => store.getGame)
const supportsReddit = computed(() => !!getGame.value?.settings[Settings.SupportsReddit])
const supportsTwitter = computed(() => !!getGame.value?.settings[Settings.SupportsTwitter])
const supportsInstagram = computed(() => !!getGame.value?.settings[Settings.SupportsInstagram])
const supportsReddit = computed(() => !!getGame.value?.settings[BikeTagSettingsKeys.SupportsReddit])
const supportsTwitter = computed(() => !!getGame.value?.settings[BikeTagSettingsKeys.SupportsTwitter])
const supportsInstagram = computed(() => !!getGame.value?.settings[BikeTagSettingsKeys.SupportsInstagram])
const redditPostText = computed(
() => `
[#${getPlayerTag.value.tagnumber} tag by ${getPlayerTag.value.foundPlayer}](https://biketag.org/${getPlayerTag.value.tagnumber})
Expand Down
6 changes: 4 additions & 2 deletions src/components/QueueView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { useBikeTagStore } from '@/store/index'
import SwiperCore, { Controller, Pagination } from 'swiper'
import 'swiper/css/bundle'
import { stringifyNumber } from '@/common/utils'
import { BiketagFormSteps } from '@/common/types'
import { BiketagQueueFormSteps } from '@/common/types'
// components
import { Swiper, SwiperSlide } from 'swiper/vue'
Expand Down Expand Up @@ -82,7 +82,9 @@ const goNextQueueStepButtonText = computed(
: t('pages.round.join_queue')
} #${getCurrentBikeTag.value?.tagnumber ?? 1}!`,
)
const showGoNextButton = computed(() => getQueuedTagState.value !== BiketagFormSteps.roundPosted)
const showGoNextButton = computed(
() => getQueuedTagState.value !== BiketagQueueFormSteps.roundPosted,
)
// methods
function goNextQueueStep() {
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import BikeTagHeader from './components/BikeTagHeader.vue'
// import BikeTagMenu from './components/BikeTagMenu.vue'
// import BikeTagPlayer from './components/BikeTagPlayer.vue'
// import BikeTagQueue from './components/BikeTagQueue.vue'
import { useBikeTagStore } from './store'
import { biketagStore, useBikeTagStore } from './store'

export {
// ExpandableImage
Expand All @@ -37,6 +37,7 @@ export {
// BikeTagMenu,
// BikeTagPlayer,
// BikeTagQueue,
biketagStore,
useBikeTagStore
}

0 comments on commit 76f4089

Please sign in to comment.