Browse Source

spencer

master
Spencer Flagg 3 years ago
parent
commit
f93ce2780d
12 changed files with 82 additions and 73 deletions
  1. +5
    -0
      .drone.yml
  2. +28
    -0
      Dockerfile
  3. +0
    -1
      components/AirportPicker.vue
  4. +26
    -3
      components/Calendar.vue
  5. +1
    -1
      components/TheSideBar.vue
  6. +7
    -0
      fl-run.sh
  7. +9
    -4
      nuxt.config.js
  8. +0
    -33
      pages/_mountain.vue
  9. +2
    -2
      pages/dates.vue
  10. +4
    -3
      pages/flights.vue
  11. +0
    -6
      pages/go.vue
  12. +0
    -20
      pages/mtns.vue

+ 5
- 0
.drone.yml View File

@ -0,0 +1,5 @@
kind: pipeline
type: docker
name: default
steps:

+ 28
- 0
Dockerfile View File

@ -0,0 +1,28 @@
FROM node:14.5.0-alpine
# create destination directory
RUN mkdir -p /usr/src/flylocal-web
WORKDIR /usr/src/flylocal-web
# update and install dependency
RUN apk update && apk upgrade
RUN apk add git
# copy the app, note .dockerignore
COPY . /usr/src/flylocal-web/
RUN yarn install
# build necessary, even if no static files are needed,
# since it builds the server as well
RUN yarn build
# expose 3000 on container
EXPOSE 3000
# set app serving to permissive / assigned
ENV NUXT_HOST=0.0.0.0
# set app port
ENV NUXT_PORT=3000
# start the app
CMD [ "yarn", "start" ]

+ 0
- 1
components/AirportPicker.vue View File

@ -110,7 +110,6 @@ export default {
}, },
data: () => ({ data: () => ({
OpenIndicator, OpenIndicator,
mountains: [],
filterBy: (option, label, search) => { filterBy: (option, label, search) => {
const temp = search.toLowerCase() const temp = search.toLowerCase()
return option.search.toLowerCase().includes(temp) return option.search.toLowerCase().includes(temp)

+ 26
- 3
components/Calendar.vue View File

@ -118,9 +118,32 @@ export default {
}, },
scheduleTime (dow) { scheduleTime (dow) {
// console.log(dow) // console.log(dow)
const thisDate = new Date(dow.DepartureTimeFormatted)
const hours = thisDate.getHours() + Math.round(thisDate.getMinutes() / 60)
return ((hours > 12) ? (hours - 12) + 'pm' : hours + 'am')
// const thisDate = new Date(dow.Departure_TimeL)
const timeArray = dow.Departure_TimeL.split(':')
const thisHour = timeArray[0]
const thisMinute = timeArray[1]
const hours = parseInt(thisHour) + Math.round(parseInt(thisMinute) / 60)
let timeString = ''
switch (true) {
case (hours > 12):
timeString = (hours - 12) + 'pm'
break
case (hours === 12):
timeString = '12pm'
break
case (hours < 12 && hours > 0):
timeString = hours + 'am'
break
case (hours === 0):
timeString = '12am'
break
default:
break
}
return timeString
} }
} }
} }

+ 1
- 1
components/TheSideBar.vue View File

@ -254,7 +254,7 @@
</a> </a>
</li> </li>
<li class="contact-item"> <li class="contact-item">
<a href="https://facebook.com/fly_local">
<a href="https://facebook.com/FlyLocalAlaska">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-brand-facebook" class="icon icon-tabler icon-tabler-brand-facebook"

+ 7
- 0
fl-run.sh View File

@ -0,0 +1,7 @@
rm -r /usr/src/flylocal-web
mkdir -p /usr/src/flylocal-web
cd /usr/src
git clone --depth 1 https://gitea.flylocal.us/spencer/flylocal-web.git
cd flylocal-web
sudo docker build -t flylocal-web .
sudo docker run -it -p 3000:3000 flylocal-web

+ 9
- 4
nuxt.config.js View File

@ -13,10 +13,10 @@ export default {
] ]
}, },
server: {
host: '192.168.178.100',
port: 3010
},
// server: {
// host: '192.168.178.100',
// port: 3010
// },
serverMiddleware: [ serverMiddleware: [
'~/middleware/redirects.js' '~/middleware/redirects.js'
@ -53,6 +53,11 @@ export default {
path: '/dates/:o/:d', path: '/dates/:o/:d',
component: resolve(__dirname, 'pages/dates.vue') component: resolve(__dirname, 'pages/dates.vue')
}, },
{
name: 'flights-orig-dest-departure-time',
path: '/flights/:o/:d/:departure/:time',
component: resolve(__dirname, 'pages/flights.vue')
},
{ {
name: 'flights-orig-dest-departure', name: 'flights-orig-dest-departure',
path: '/flights/:o/:d/:departure', path: '/flights/:o/:d/:departure',

+ 0
- 33
pages/_mountain.vue View File

@ -1,33 +0,0 @@
<template>
<div>
<h1>Continent: {{ continent }}</h1>
<h2>Mountain: {{ mountain }}</h2>
<p>Path: {{ $route.path }}</p>
<NuxtLink to="/">
Back to Mountains
</NuxtLink>
</div>
</template>
<script>
export default {
async asyncData ({ params, redirect }) {
const mountains = await fetch(
'https://api.nuxtjs.dev/mountains'
).then(res => res.json())
const filteredMountain = mountains.find(
el =>
el.continent.toLowerCase() === params.continent &&
el.slug === params.mountain
)
if (filteredMountain) {
return {
continent: filteredMountain.continent,
mountain: filteredMountain.title
}
} else {
redirect('/')
}
}
}
</script>

+ 2
- 2
pages/dates.vue View File

@ -69,7 +69,7 @@ export default {
// const tomorrow = addDays(new Date(), 1).toLocaleDateString('en-CA') // const tomorrow = addDays(new Date(), 1).toLocaleDateString('en-CA')
const scheduleFetchFilterFormula = `AND(Is_Current="Yes",Origin_IATA="${this.$route.params.o}",Destination_IATA="${this.$route.params.d}",Effective_End>"${today}")` const scheduleFetchFilterFormula = `AND(Is_Current="Yes",Origin_IATA="${this.$route.params.o}",Destination_IATA="${this.$route.params.d}",Effective_End>"${today}")`
const scheduleFetchSort = '&sort[0][field]=DepartureTimeFormatted&sort[0][direction]=asc'
const scheduleFetchSort = '&sort[0][field]=Departure_TimeL&sort[0][direction]=asc'
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Schedule?filterByFormula=${scheduleFetchFilterFormula}${scheduleFetchSort}`, { const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Schedule?filterByFormula=${scheduleFetchFilterFormula}${scheduleFetchSort}`, {
method: 'GET', method: 'GET',
@ -94,7 +94,7 @@ export default {
DowsList: this.daysList(schedule.fields.Frequency_Convert), DowsList: this.daysList(schedule.fields.Frequency_Convert),
Effective_Start: schedule.fields.Effective_Start, Effective_Start: schedule.fields.Effective_Start,
Effective_End: schedule.fields.Effective_End, Effective_End: schedule.fields.Effective_End,
DepartureTimeFormatted: schedule.fields.DepartureTimeFormatted
Departure_TimeL: schedule.fields.Departure_TimeL
} }
}) })
return mappedDows return mappedDows

+ 4
- 3
pages/flights.vue View File

@ -204,7 +204,7 @@ export default {
const scheduleFetchFilterFormula = `AND(Is_Current="Yes",Origin_IATA="${this.$route.params.o}",Destination_IATA="${this.$route.params.d}",Effective_End>"${today}",SEARCH("${new Date(this.$route.params.departure).getDay()}",Frequency)>0)` const scheduleFetchFilterFormula = `AND(Is_Current="Yes",Origin_IATA="${this.$route.params.o}",Destination_IATA="${this.$route.params.d}",Effective_End>"${today}",SEARCH("${new Date(this.$route.params.departure).getDay()}",Frequency)>0)`
// console.log(scheduleFetchFilterFormula) // console.log(scheduleFetchFilterFormula)
const scheduleFetchSort = '&sort[0][field]=DepartureTimeFormatted&sort[0][direction]=asc'
const scheduleFetchSort = '&sort[0][field]=Departure_TimeL&sort[0][direction]=asc'
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Schedule?filterByFormula=${scheduleFetchFilterFormula}${scheduleFetchSort}`, { const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Schedule?filterByFormula=${scheduleFetchFilterFormula}${scheduleFetchSort}`, {
method: 'GET', method: 'GET',
@ -235,7 +235,7 @@ export default {
const thisDate = new Date(date) const thisDate = new Date(date)
const month = thisDate.toLocaleString('en-us', { month: 'short' }) const month = thisDate.toLocaleString('en-us', { month: 'short' })
const year = ((thisDate.getFullYear() !== new Date().getFullYear()) ? ', ' + thisDate.getFullYear() : '') const year = ((thisDate.getFullYear() !== new Date().getFullYear()) ? ', ' + thisDate.getFullYear() : '')
return month + ' ' + thisDate.getDate() + year
return month + ' ' + thisDate.getUTCDate() + year
}, },
daysList (days) { daysList (days) {
const list = days.split(', ').map((day) => { const list = days.split(', ').map((day) => {
@ -506,7 +506,8 @@ span.text--flight-num {
span.text--dow { span.text--dow {
font-weight: 300; font-weight: 300;
letter-spacing: -0.1em;
font-size: 0.8rem;
color: #007fff;
} }
span.badge--avail { span.badge--avail {

+ 0
- 6
pages/go.vue View File

@ -107,12 +107,6 @@ export default {
data () { data () {
return { return {
color: 'red', color: 'red',
mountains: [
{
slug: 'sluggy',
title: 'titly'
}
],
isSidebarVisible: false, isSidebarVisible: false,
isPickerVisible: false, isPickerVisible: false,
airports_orig: [], airports_orig: [],

+ 0
- 20
pages/mtns.vue View File

@ -1,20 +0,0 @@
<template>
<div>
<ul v-for="mountain in mountains" :key="mountain.id">
<NuxtLink :to="`${mountain.continent.toLowerCase()}/${mountain.slug}`">
<li>{{ mountain.title }}</li>
</NuxtLink>
</ul>
</div>
</template>
<script>
export default {
async asyncData () {
const mountains = await fetch(
'https://api.nuxtjs.dev/mountains'
).then(res => res.json())
return { mountains }
}
}
</script>

Loading…
Cancel
Save