mirror of https://github.com/Qiskit/qiskit.org.git
Updates location categories (#508)
* Modifies some data to fit new filters * Updates filters and refactor code * Moves LOCATION_CATEGORIES to events store
This commit is contained in:
parent
b15b305b2c
commit
72a7a79354
|
@ -7,25 +7,6 @@ type LabeledFilters = {
|
|||
[key: string]: Filter
|
||||
}
|
||||
|
||||
const LOCATION_FILTERS: LabeledFilters = {
|
||||
america: {
|
||||
label: 'America',
|
||||
value: 'america'
|
||||
},
|
||||
europe: {
|
||||
label: 'Europe',
|
||||
value: 'europe'
|
||||
},
|
||||
africa: {
|
||||
label: 'Africa',
|
||||
value: 'africa'
|
||||
},
|
||||
asia: {
|
||||
label: 'Asia',
|
||||
value: 'asia'
|
||||
}
|
||||
}
|
||||
|
||||
const TYPES_FILTERS: LabeledFilters = {
|
||||
camp: {
|
||||
label: 'Camp',
|
||||
|
@ -41,13 +22,6 @@ const TYPES_FILTERS: LabeledFilters = {
|
|||
}
|
||||
}
|
||||
|
||||
const ORDERED_LOCATION_FILTERS: Array<Filter> = [
|
||||
LOCATION_FILTERS.america,
|
||||
LOCATION_FILTERS.asia,
|
||||
LOCATION_FILTERS.europe,
|
||||
LOCATION_FILTERS.africa
|
||||
]
|
||||
|
||||
const ORDERED_TYPE_FILTERS: Array<Filter> = [
|
||||
TYPES_FILTERS.camp,
|
||||
TYPES_FILTERS.unconference,
|
||||
|
@ -55,7 +29,6 @@ const ORDERED_TYPE_FILTERS: Array<Filter> = [
|
|||
]
|
||||
|
||||
export {
|
||||
ORDERED_LOCATION_FILTERS,
|
||||
ORDERED_TYPE_FILTERS,
|
||||
Filter
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"type": "Hackathon",
|
||||
"image": "/images/events/promo-finland-unconference.jpg",
|
||||
"place": "Dublin, Ireland",
|
||||
"location": "Asia",
|
||||
"location": "Asia Pacific",
|
||||
"date": "March 28, 2020"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"type": "Hackathon",
|
||||
"image": "/images/events/promo-finland-unconference.jpg",
|
||||
"place": "Stanford, CA",
|
||||
"location": "Europe",
|
||||
"location": "Online",
|
||||
"date": "May 1-2, 2020"
|
||||
}
|
||||
]
|
|
@ -1,5 +1,12 @@
|
|||
import Airtable from 'airtable'
|
||||
import { CommunityEvent, CommunityEventType, WorldLocation } from '~/store/modules/events.ts'
|
||||
|
||||
// TODO: Understand why this import works with '../' and not with '~/'
|
||||
import {
|
||||
CommunityEvent,
|
||||
CommunityEventType,
|
||||
WorldLocation,
|
||||
LOCATION_CATEGORIES
|
||||
} from '../store/modules/events'
|
||||
|
||||
const RECORD_FIELDS = {
|
||||
name: 'Name',
|
||||
|
@ -74,7 +81,7 @@ function getPlace (record: any) {
|
|||
}
|
||||
|
||||
function getLocation (_record: any): WorldLocation {
|
||||
const options: WorldLocation[] = ['America', 'Asia', 'Europe', 'Africa']
|
||||
const options: WorldLocation[] = LOCATION_CATEGORIES
|
||||
return options[Math.floor(Math.random() * options.length)]
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import pkg from './package.json'
|
|||
import generateTextbookToc from './hooks/generate-textbook-toc'
|
||||
import fetchEvents from './hooks/update-events'
|
||||
|
||||
const IS_PRODUCTION = process.env.NODE_ENV === 'production'
|
||||
const GENERATE_CONTENT = process.env.GENERATE_CONTENT
|
||||
const AIRTABLE_API_KEY = process.env.AIRTABLE_API_KEY
|
||||
const { NODE_ENV, GENERATE_CONTENT, AIRTABLE_API_KEY } = process.env
|
||||
|
||||
const IS_PRODUCTION = NODE_ENV === 'production'
|
||||
|
||||
const md = markdownIt({
|
||||
linkify: true,
|
||||
|
@ -34,7 +34,6 @@ md.use(miAnchor, {
|
|||
|
||||
const config: Configuration = {
|
||||
mode: 'universal',
|
||||
|
||||
env: {
|
||||
analyticsScriptUrl: IS_PRODUCTION
|
||||
? 'https://cloud.ibm.com/analytics/build/bluemix-analytics.min.js'
|
||||
|
|
|
@ -1631,15 +1631,6 @@
|
|||
"integrity": "sha512-hrIjWSu7Hh96/rKlpChe58qHEwIZ0+F5Zf4QNdvSVP5LUXbaJM04g9tBjo702VTNqPZr5znEJeqNR3nAV3vJPg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/cheerio": {
|
||||
"version": "0.22.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.17.tgz",
|
||||
"integrity": "sha512-izlm+hbqWN9csuB9GSMfCnAyd3/57XZi3rfz1B0C4QBGVMp+9xQ7+9KYnep+ySfUrCWql4lGzkLf0XmprXcz9g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/clean-css": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/clean-css/-/clean-css-4.2.1.tgz",
|
||||
|
@ -5516,75 +5507,6 @@
|
|||
"resolved": "https://registry.npmjs.org/check-types/-/check-types-8.0.3.tgz",
|
||||
"integrity": "sha512-YpeKZngUmG65rLudJ4taU7VLkOCTMhNl/u4ctNC56LQS/zJTyNH0Lrtwm1tfTsbLlwvlfsA2d1c8vCf/Kh2KwQ=="
|
||||
},
|
||||
"cheerio": {
|
||||
"version": "1.0.0-rc.3",
|
||||
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz",
|
||||
"integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"css-select": "~1.2.0",
|
||||
"dom-serializer": "~0.1.1",
|
||||
"entities": "~1.1.1",
|
||||
"htmlparser2": "^3.9.1",
|
||||
"lodash": "^4.15.0",
|
||||
"parse5": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"css-select": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
|
||||
"integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boolbase": "~1.0.0",
|
||||
"css-what": "2.1",
|
||||
"domutils": "1.5.1",
|
||||
"nth-check": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"css-what": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz",
|
||||
"integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==",
|
||||
"dev": true
|
||||
},
|
||||
"dom-serializer": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
|
||||
"integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"domelementtype": "^1.3.0",
|
||||
"entities": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"domutils": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
|
||||
"integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"dom-serializer": "0",
|
||||
"domelementtype": "1"
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
|
||||
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==",
|
||||
"dev": true
|
||||
},
|
||||
"parse5": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz",
|
||||
"integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"chokidar": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz",
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
<client-only>
|
||||
<cv-checkbox
|
||||
v-for="location in locations"
|
||||
:key="location.value"
|
||||
:value="location.value"
|
||||
:label="location.label"
|
||||
:checked="isFilterChecked('locationFilters', location.label)"
|
||||
:aria-checked="`${isFilterChecked('locationFilters', location.label)}`"
|
||||
@change="updateFilter('locationFilters', location.label, $event)"
|
||||
:key="location"
|
||||
:value="location"
|
||||
:label="location"
|
||||
:checked="isFilterChecked('locationFilters', location)"
|
||||
:aria-checked="`${isFilterChecked('locationFilters', location)}`"
|
||||
@change="updateFilter('locationFilters', location, $event)"
|
||||
/>
|
||||
</client-only>
|
||||
</fieldset>
|
||||
|
@ -85,13 +85,8 @@ import { mapGetters, mapActions } from 'vuex'
|
|||
import { Component } from 'vue-property-decorator'
|
||||
import QiskitPage from '~/components/qiskit/QiskitPage.vue'
|
||||
import EventCard from '~/components/cards/EventCard.vue'
|
||||
import {
|
||||
ORDERED_LOCATION_FILTERS,
|
||||
ORDERED_TYPE_FILTERS,
|
||||
Filter
|
||||
} from '~/constants/filters'
|
||||
|
||||
import { CommunityEvent } from '~/store/modules/events.ts'
|
||||
import { ORDERED_TYPE_FILTERS, Filter } from '~/constants/filters'
|
||||
import { CommunityEvent, LOCATION_CATEGORIES } from '~/store/modules/events.ts'
|
||||
|
||||
@Component({
|
||||
layout: 'carbon',
|
||||
|
@ -132,7 +127,7 @@ import { CommunityEvent } from '~/store/modules/events.ts'
|
|||
})
|
||||
|
||||
export default class extends QiskitPage {
|
||||
locations: Array<Filter> = ORDERED_LOCATION_FILTERS
|
||||
locations = LOCATION_CATEGORIES
|
||||
types: Array<Filter> = ORDERED_TYPE_FILTERS
|
||||
routeName: string = 'events'
|
||||
windowWidth: Number = 0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
type CommunityEventSet = 'past'|'upcoming'
|
||||
type WorldLocation = 'America'|'Asia'|'Europe'|'Africa'|'TBD'
|
||||
type WorldLocation = 'Americas'|'Asia Pacific'|'Europe'|'Africa'|'TBD'|'Online'
|
||||
type CommunityEventType = 'Hackathon'|'Camp'|'Unconference'|'Conference'
|
||||
|
||||
type CommunityEvent = {
|
||||
|
@ -12,7 +12,9 @@ type CommunityEvent = {
|
|||
to: string
|
||||
}
|
||||
|
||||
export { CommunityEvent, CommunityEventType, WorldLocation }
|
||||
const LOCATION_CATEGORIES: WorldLocation[] = ['Americas', 'Asia Pacific', 'Europe', 'Africa', 'Online']
|
||||
|
||||
export { CommunityEvent, CommunityEventType, WorldLocation, LOCATION_CATEGORIES }
|
||||
|
||||
export default {
|
||||
state: {
|
||||
|
|
Loading…
Reference in New Issue