@ -0,0 +1,13 @@ | |||||
# editorconfig.org | |||||
root = true | |||||
[*] | |||||
indent_style = space | |||||
indent_size = 2 | |||||
end_of_line = lf | |||||
charset = utf-8 | |||||
trim_trailing_whitespace = true | |||||
insert_final_newline = true | |||||
[*.md] | |||||
trim_trailing_whitespace = false |
@ -0,0 +1,20 @@ | |||||
module.exports = { | |||||
root: true, | |||||
env: { | |||||
browser: true, | |||||
node: true | |||||
}, | |||||
parserOptions: { | |||||
parser: '@babel/eslint-parser', | |||||
requireConfigFile: false | |||||
}, | |||||
extends: [ | |||||
'@nuxtjs', | |||||
'plugin:nuxt/recommended' | |||||
// 'plugin:eslint/recommended' | |||||
], | |||||
plugins: [ | |||||
], | |||||
// add your custom rules here | |||||
rules: {} | |||||
} |
@ -0,0 +1,90 @@ | |||||
# Created by .ignore support plugin (hsz.mobi) | |||||
### Node template | |||||
# Logs | |||||
/logs | |||||
*.log | |||||
npm-debug.log* | |||||
yarn-debug.log* | |||||
yarn-error.log* | |||||
# Runtime data | |||||
pids | |||||
*.pid | |||||
*.seed | |||||
*.pid.lock | |||||
# Directory for instrumented libs generated by jscoverage/JSCover | |||||
lib-cov | |||||
# Coverage directory used by tools like istanbul | |||||
coverage | |||||
# nyc test coverage | |||||
.nyc_output | |||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | |||||
.grunt | |||||
# Bower dependency directory (https://bower.io/) | |||||
bower_components | |||||
# node-waf configuration | |||||
.lock-wscript | |||||
# Compiled binary addons (https://nodejs.org/api/addons.html) | |||||
build/Release | |||||
# Dependency directories | |||||
node_modules/ | |||||
jspm_packages/ | |||||
# TypeScript v1 declaration files | |||||
typings/ | |||||
# Optional npm cache directory | |||||
.npm | |||||
# Optional eslint cache | |||||
.eslintcache | |||||
# Optional REPL history | |||||
.node_repl_history | |||||
# Output of 'npm pack' | |||||
*.tgz | |||||
# Yarn Integrity file | |||||
.yarn-integrity | |||||
# dotenv environment variables file | |||||
.env | |||||
# parcel-bundler cache (https://parceljs.org/) | |||||
.cache | |||||
# next.js build output | |||||
.next | |||||
# nuxt.js build output | |||||
.nuxt | |||||
# Nuxt generate | |||||
dist | |||||
# vuepress build output | |||||
.vuepress/dist | |||||
# Serverless directories | |||||
.serverless | |||||
# IDE / Editor | |||||
.idea | |||||
# Service worker | |||||
sw.* | |||||
# macOS | |||||
.DS_Store | |||||
# Vim swap files | |||||
*.swp |
@ -0,0 +1,33 @@ | |||||
{ | |||||
"version": "0.2.0", | |||||
"configurations": [ | |||||
{ | |||||
"type": "chrome", | |||||
"request": "launch", | |||||
"name": "client: chrome", | |||||
"url": "http://localhost:3000", | |||||
"webRoot": "${workspaceFolder}" | |||||
}, | |||||
{ | |||||
"type": "node", | |||||
"request": "launch", | |||||
"name": "server: nuxt", | |||||
"args": ["dev"], | |||||
"osx": { | |||||
"program": "${workspaceFolder}/node_modules/.bin/nuxt" | |||||
}, | |||||
"linux": { | |||||
"program": "${workspaceFolder}/node_modules/.bin/nuxt" | |||||
}, | |||||
"windows": { | |||||
"program": "${workspaceFolder}/node_modules/nuxt/bin/nuxt.js" | |||||
} | |||||
} | |||||
], | |||||
"compounds": [ | |||||
{ | |||||
"name": "fullstack: nuxt", | |||||
"configurations": ["server: nuxt", "client: chrome"] | |||||
} | |||||
] | |||||
} |
@ -0,0 +1,5 @@ | |||||
{ | |||||
"editor.codeActionsOnSave": { | |||||
"source.fixAll": true | |||||
} | |||||
} |
@ -0,0 +1,123 @@ | |||||
/* eslint-disable */ | |||||
<!DOCTYPE html> | |||||
<html lang="en"> | |||||
<head> | |||||
<meta charset="UTF-8"> | |||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |||||
<title>Document</title> | |||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" | |||||
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" | |||||
crossorigin="" /> | |||||
<style> | |||||
html { | |||||
background-color: black; | |||||
} | |||||
html, | |||||
body { | |||||
height: 100vh; | |||||
width: 100vw; | |||||
margin: 0; | |||||
padding: 0; | |||||
} | |||||
#mapid { | |||||
height: 100vh; | |||||
/* width:100vw; | |||||
margin:0; | |||||
padding:0; */ | |||||
} | |||||
</style> | |||||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.0/dist/MarkerCluster.css"> | |||||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.0/dist/MarkerCluster.Default.css"> | |||||
</head> | |||||
<body> | |||||
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" | |||||
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" | |||||
crossorigin=""></script> | |||||
<!-- <script src="leaflet.geojsoncss.js"></script> --> | |||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-polylinedecorator/1.0.1/leaflet.polylineDecorator.min.js"></script> | |||||
<script src='https://unpkg.com/leaflet-arc/bin/leaflet-arc.min.js'></script> | |||||
<script src="https://unpkg.com/leaflet.markercluster@1.5.0/dist/leaflet.markercluster.js"></script> | |||||
<script src="L.Polyline.SnakeAnim.js"></script> | |||||
<div id="mapid"></div> | |||||
<script src="index.js"></script> | |||||
</body> | |||||
</html> | |||||
RAW Paste Data | |||||
<!DOCTYPE html> | |||||
<html lang="en"> | |||||
<head> | |||||
<meta charset="UTF-8"> | |||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |||||
<title>Document</title> | |||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" | |||||
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" | |||||
crossorigin="" /> | |||||
<style> | |||||
html { | |||||
background-color: black; | |||||
} | |||||
html, | |||||
body { | |||||
height: 100vh; | |||||
width: 100vw; | |||||
margin: 0; | |||||
padding: 0; | |||||
} | |||||
#mapid { | |||||
height: 100vh; | |||||
/* width:100vw; | |||||
margin:0; | |||||
padding:0; */ | |||||
} | |||||
</style> | |||||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.0/dist/MarkerCluster.css"> | |||||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.0/dist/MarkerCluster.Default.css"> | |||||
</head> | |||||
<body> | |||||
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" | |||||
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" | |||||
crossorigin=""></script> | |||||
<!-- <script src="leaflet.geojsoncss.js"></script> --> | |||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-polylinedecorator/1.0.1/leaflet.polylineDecorator.min.js"></script> | |||||
<script src='https://unpkg.com/leaflet-arc/bin/leaflet-arc.min.js'></script> | |||||
<script src="https://unpkg.com/leaflet.markercluster@1.5.0/dist/leaflet.markercluster.js"></script> | |||||
<script src="L.Polyline.SnakeAnim.js"></script> | |||||
<div id="mapid"></div> | |||||
<script src="index.js"></script> | |||||
</body> | |||||
</html> | |||||
@ -0,0 +1,234 @@ | |||||
/* eslint-disable */ | |||||
var map = L.map('mapid').setView([63.8333, -152], 1), | |||||
accessToken = 'pk.eyJ1IjoiZmx5bG9jYWwiLCJhIjoiY2t0OHUxZXB6MTVueTJ4cGVwOHRuc2s2NyJ9.YF9frLvISHfOuT7nqs3TNg', | |||||
apiUrl = `https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=${accessToken}`; | |||||
var form = `AND(Is_Origin=1,{IsCurrent-AsOrigin}='Yes')`; | |||||
var markers = L.markerClusterGroup(); | |||||
var destinationsLayer = L.layerGroup(); | |||||
var points = [], | |||||
mainOffset; | |||||
async function fetchMapData() { | |||||
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${form}&fields[]=Airport_IATA&fields[]=Icon_Url&fields[]=Latitude_Deg&fields[]=Longitude_Deg&sort[0][field]=Airport_IATA&sort[0][direction]=asc`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
'Authorization': 'Bearer keyJ2ht64ZSN57AG1' | |||||
}, | |||||
}); | |||||
response.ok; // => false | |||||
response.status; // => 404 | |||||
const mapData = await response.json(); | |||||
points = mapData.records; | |||||
mainOffset = mapData.offset; | |||||
return mapData; | |||||
} | |||||
async function fetchMapData2(mapData) { | |||||
if (mapData.offset) { | |||||
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${form}&fields[]=Airport_IATA&fields[]=Icon_Url&fields[]=Latitude_Deg&fields[]=Longitude_Deg&sort[0][field]=Airport_IATA&sort[0][direction]=asc&offset=${mapData.offset}`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
'Authorization': 'Bearer keyJ2ht64ZSN57AG1' | |||||
}, | |||||
}); | |||||
response.ok; // => false | |||||
response.status; // => 404 | |||||
const mapData2 = await response.json(); | |||||
points = [...points, ...mapData2.records]; | |||||
return mapData2; | |||||
} | |||||
} | |||||
function getOrigIcon(icon) { | |||||
var origIcon = L.icon({ | |||||
iconUrl: icon, | |||||
//shadowUrl: 'leaf-shadow.png', | |||||
iconSize: [80, 40], // size of the icon | |||||
//shadowSize: [50, 64], // size of the shadow | |||||
iconAnchor: [40, 40], // point of the icon which will correspond to marker's location | |||||
//shadowAnchor: [4, 62], // the same for the shadow | |||||
popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor | |||||
}); | |||||
return origIcon; | |||||
} | |||||
function getBlueIcon() { | |||||
var origIcon = L.icon({ | |||||
iconUrl: 'https://spencerflagg.com/flylocal/pins/pin.svg', | |||||
//shadowUrl: 'leaf-shadow.png', | |||||
iconSize: [14, 16], // size of the icon | |||||
//shadowSize: [50, 64], // size of the shadow | |||||
iconAnchor: [7, 16], // point of the icon which will correspond to marker's location | |||||
//shadowAnchor: [4, 62], // the same for the shadow | |||||
popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor | |||||
}); | |||||
return origIcon; | |||||
} | |||||
fetchMapData().then(mapData => { | |||||
fetchMapData2(mapData).then(function () { | |||||
var mapDataFiltered = points.map((record) => { | |||||
return { | |||||
"iata": record.fields.Airport_IATA, | |||||
"lat": record.fields.Latitude_Deg, | |||||
"long": record.fields.Longitude_Deg, | |||||
"icon": record.fields.Icon_Url | |||||
} | |||||
}); | |||||
console.log(mapDataFiltered); // => 'Page not found' | |||||
mapDataFiltered.forEach((record) => { | |||||
var popupContent = ` | |||||
<div>${record.iata}</div> | |||||
<button id='origBtn' data-iata='${record.iata}' data-lat='${record.lat}' data-long='${record.long}'>make origin</button> | |||||
`; | |||||
var marker = L.marker([record.lat, record.long], { icon: getOrigIcon(record.icon + '+FFFFFF+BBBBBB+000000') }) | |||||
.bindPopup(popupContent); | |||||
//.addTo(map); | |||||
markers.addLayer(marker); | |||||
}); | |||||
}) | |||||
}); | |||||
//console.log(mapData[0].Airport_IATA); | |||||
L.tileLayer(apiUrl, { | |||||
attribution: 'FlyLocal | Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', | |||||
maxZoom: 18, | |||||
//id: 'mapbox/streets-v11', | |||||
//id: 'mapbox/outdoors-v11', | |||||
//id: 'mapbox/satellite-streets-v11', | |||||
id: 'flylocal/ckt9x8aho0igb18mmm9ks2fsv', | |||||
tileSize: 512, | |||||
zoomOffset: -1, | |||||
accessToken: 'your.mapbox.access.token' | |||||
}).addTo(map); | |||||
map.addLayer(markers); | |||||
map.on('popupopen', function (e) { | |||||
var thisMarker = e.popup._source; | |||||
console.log(thisMarker); | |||||
var origButton = document.getElementById("origBtn"), | |||||
destButton = document.getElementById("destBtn"); | |||||
origButton.addEventListener("click", function () { | |||||
//alert(thisButton.dataset.iata); | |||||
fetchDestData(origButton.dataset.iata).then(mapData => { | |||||
var mapDataFiltered = mapData.records.map((record) => { | |||||
return { | |||||
"iata": record.fields.Airport_IATA, | |||||
"lat": record.fields.Latitude_Deg, | |||||
"long": record.fields.Longitude_Deg, | |||||
"icon": record.fields.Icon_Url | |||||
} | |||||
}); | |||||
console.log(mapDataFiltered); // => 'Page not found' | |||||
map.removeLayer(markers); | |||||
// re-add origin | |||||
var marker = L.marker([thisButton.dataset.lat, thisButton.dataset.long], { icon: getBlueIcon() }) | |||||
.addTo(map); | |||||
destinationsLayer.clearLayers(); | |||||
map.removeLayer(destinationsLayer); | |||||
// add all destinations | |||||
mapDataFiltered.forEach((record) => { | |||||
var popupContent = ` | |||||
<div>${record.iata}</div> | |||||
<button id='origBtn' data-iata='${record.iata}' data-lat='${record.lat}' data-long='${record.long}'>make origin</button> | |||||
<button id='destBtn' data-iata='${record.iata}' data-lat='${record.lat}' data-long='${record.long}'>make destination</button> | |||||
`; | |||||
var marker = L.marker([record.lat, record.long], { icon: getOrigIcon(record.icon + '+05FF00+04C300+000000') }) | |||||
.bindPopup(popupContent).addTo(map); | |||||
}); | |||||
map.addLayer(destinationsLayer); | |||||
}); | |||||
}); | |||||
destButton.addEventListener("click", function () { | |||||
var lat = origButton.dataset.lat, | |||||
long = origButton.dataset.long; | |||||
var thisArc = L.Polyline.Arc([thisButton.dataset.lat, thisButton.dataset.long], [record.lat, record.long], { | |||||
vertices: 200, | |||||
}); | |||||
var thisDecorator = L.polylineDecorator(thisArc, { | |||||
patterns: [ | |||||
// defines a pattern of 10px-wide dashes, repeated every 20px on the line | |||||
{ offset: 0, repeat: 20, symbol: L.Symbol.dash({ pixelSize: 3, pathOptions: { color: '#007FFF', weight: 8, lineCap: 'square' } }) }, | |||||
{ offset: '100%', repeat: 0, symbol: L.Symbol.arrowHead({ pixelSize: 15, polygon: false, pathOptions: { stroke: true, color: '#007FFF', weight: 8, lineCap: 'square' } }) } | |||||
] | |||||
}); | |||||
destinationsLayer.addLayer(thisDecorator); | |||||
}); | |||||
}); | |||||
async function fetchDestData(iata) { | |||||
var destFormula = `AND(Is_Destination=1,{IsCurrent-AsDest}="Yes",(FIND("${iata}", Associated_Origin_Search)>0))`; | |||||
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${destFormula}&fields[]=Airport_IATA&fields[]=Latitude_Deg&fields[]=Longitude_Deg&fields[]=Icon_Url&sort[0][field]=Airport_IATA&sort[0][direction]=asc`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
'Authorization': 'Bearer keyJ2ht64ZSN57AG1' | |||||
}, | |||||
}); | |||||
response.ok; // => false | |||||
response.status; // => 404 | |||||
const mapData = await response.json(); | |||||
points = mapData.records; | |||||
mainOffset = mapData.offset; | |||||
return mapData; | |||||
} |
@ -0,0 +1,69 @@ | |||||
# flylocal-v5-nuxt | |||||
## Build Setup | |||||
```bash | |||||
# install dependencies | |||||
$ yarn install | |||||
# serve with hot reload at localhost:3000 | |||||
$ yarn dev | |||||
# build for production and launch server | |||||
$ yarn build | |||||
$ yarn start | |||||
# generate static project | |||||
$ yarn generate | |||||
``` | |||||
For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org). | |||||
## Special Directories | |||||
You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality. | |||||
### `assets` | |||||
The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/assets). | |||||
### `components` | |||||
The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/components). | |||||
### `layouts` | |||||
Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts). | |||||
### `pages` | |||||
This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/get-started/routing). | |||||
### `plugins` | |||||
The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use `Vue.use()`, you should create a file in `plugins/` and add its path to plugins in `nuxt.config.js`. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/plugins). | |||||
### `static` | |||||
This directory contains your static files. Each file inside this directory is mapped to `/`. | |||||
Example: `/static/robots.txt` is mapped as `/robots.txt`. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/static). | |||||
### `store` | |||||
This directory contains your Vuex store files. Creating a file in this directory automatically activates Vuex. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/store). |
@ -0,0 +1,504 @@ | |||||
<template> | |||||
<div id="map-wrap"> | |||||
<client-only> | |||||
<l-map ref="myMap" v-bind="map"> | |||||
<v-marker-cluster v-if="!selectedOrigin.key"> | |||||
<l-marker | |||||
v-for="airport in airports_orig" | |||||
:key="airport.iata" | |||||
:lat-lng="[airport.lat, airport.long]" | |||||
> | |||||
<l-icon | |||||
:icon-anchor="[16, 37]" | |||||
class-name="airport-icon orig-icon unselected" | |||||
> | |||||
<div class="map__icon-muni"> | |||||
{{ airport.municipality }} ► | |||||
</div> | |||||
</l-icon> | |||||
<l-popup class="map__popup"> | |||||
<div class="map__popup-iata"> | |||||
{{ airport.iata }} | |||||
</div> | |||||
<div class="map__popup-muni"> | |||||
{{ airport.municipality }} | |||||
</div> | |||||
<div class="map__popup-buttons"> | |||||
<button class="btn btn--primary btn--map" @click="makeOrigin(airport)"> | |||||
start here ► | |||||
</button> | |||||
</div> | |||||
</l-popup> | |||||
</l-marker> | |||||
</v-marker-cluster> | |||||
<v-marker-cluster v-if="selectedOrigin.key && !selectedDestination.key"> | |||||
<l-marker | |||||
v-for="airport in airports_dest" | |||||
:key="airport.iata" | |||||
:lat-lng="[airport.lat, airport.long]" | |||||
> | |||||
<l-icon | |||||
:icon-anchor="[16, 37]" | |||||
class-name="airport-icon dest-icon unselected" | |||||
> | |||||
<div class="map__icon-muni"> | |||||
{{ airport.municipality }} ■ | |||||
</div> | |||||
</l-icon> | |||||
<l-popup class="map__popup"> | |||||
<div class="map__popup-iata"> | |||||
{{ airport.iata }} | |||||
</div> | |||||
<div class="map__popup-muni"> | |||||
{{ airport.municipality }} | |||||
</div> | |||||
<div class="map__popup-buttons"> | |||||
<button | |||||
class="btn btn--primary btn--map" | |||||
@click="makeDestination(airport)" | |||||
> | |||||
land here ■ | |||||
</button> | |||||
<button class="btn btn--secondary btn--map" @click="makeOrigin(airport)"> | |||||
start here ► | |||||
</button> | |||||
</div> | |||||
</l-popup> | |||||
</l-marker> | |||||
</v-marker-cluster> | |||||
<l-marker v-if="selectedOrigin.key" v-bind="selectedOrigin"> | |||||
<l-icon | |||||
:icon-anchor="[16, 37]" | |||||
class-name="airport-icon orig-icon selected" | |||||
> | |||||
<div class="map__icon-muni"> | |||||
{{ selectedOrigin.municipality }} | |||||
</div> | |||||
</l-icon> | |||||
<l-popup class="map__popup"> | |||||
<div class="map__popup-iata"> | |||||
{{ selectedOrigin.iata }} | |||||
</div> | |||||
<div class="map__popup-muni"> | |||||
{{ selectedOrigin.municipality }} | |||||
</div> | |||||
<div class="map__popup-buttons"> | |||||
<button class="btn btn--cancel btn--map" @click="clearOrigin()"> | |||||
remove | |||||
</button> | |||||
</div> | |||||
</l-popup> | |||||
</l-marker> | |||||
<l-marker v-if="selectedDestination.key" v-bind="selectedDestination"> | |||||
<l-icon | |||||
:icon-anchor="[16, 37]" | |||||
class-name="airport-icon dest-icon selected" | |||||
> | |||||
<div class="map__icon-muni"> | |||||
{{ selectedDestination.municipality }} | |||||
</div> | |||||
</l-icon> | |||||
<l-popup class="map__popup"> | |||||
<div class="map__popup-iata"> | |||||
{{ selectedDestination.iata }} | |||||
</div> | |||||
<div class="map__popup-muni"> | |||||
{{ selectedDestination.municipality }} | |||||
</div> | |||||
<div class="map__popup-buttons"> | |||||
<button class="btn btn--cancel btn--map" @click="clearDestination()"> | |||||
remove | |||||
</button> | |||||
</div> | |||||
</l-popup> | |||||
</l-marker> | |||||
<!-- <l-polyline :lat-lngs="polyline.latlngs" :color="polyline.color" /> --> | |||||
<!-- <l-tile-layer v-bind="tileLayer" :url="mapBoxUrl" /> --> | |||||
<l-tile-layer :url="osmUrl" :attribution="osmAttribution" /> | |||||
</l-map> | |||||
</client-only> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
export default { | |||||
data () { | |||||
return { | |||||
map: { | |||||
zoom: 3, | |||||
minZoom: 3, | |||||
maxZoom: 13, | |||||
center: { | |||||
lat: 63.8333, | |||||
lng: -152 | |||||
}, | |||||
bounds: [ | |||||
[ | |||||
71.0394374664382, | |||||
-178.4706617597655 | |||||
], | |||||
[ | |||||
50.44556513009691, | |||||
-127.25240004101528 | |||||
] | |||||
] | |||||
}, | |||||
mapBoxAccessToken: 'pk.eyJ1IjoiZmx5bG9jYWwiLCJhIjoiY2t0OHUxZXB6MTVueTJ4cGVwOHRuc2s2NyJ9.YF9frLvISHfOuT7nqs3TNg', | |||||
mapBoxAttribution: 'FlyLocal | Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', | |||||
osmUrl: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', | |||||
osmAttribution: | |||||
'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors', | |||||
mapBoxUrl: 'https://api.mapbox.com/styles/v1/flylocal/ckt9x8aho0igb18mmm9ks2fsv/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZmx5bG9jYWwiLCJhIjoiY2t0OHUxZXB6MTVueTJ4cGVwOHRuc2s2NyJ9.YF9frLvISHfOuT7nqs3TNg', | |||||
// address: { | |||||
// long: '', | |||||
// display: '' | |||||
// }, | |||||
// polyline: { | |||||
// color: 'red', | |||||
// latlngs: [] | |||||
// }, | |||||
airports_orig: [], | |||||
airports_dest: [], | |||||
airportFetch_filterFormula: 'AND(Is_Origin=1,{IsCurrent-AsOrigin}=\'Yes\')', | |||||
airportFetch_fields: [ | |||||
'Airport_IATA', | |||||
'Icon_Url', | |||||
'Latitude_Deg', | |||||
'Longitude_Deg', | |||||
'Municipality', | |||||
'Type' | |||||
], | |||||
airportFetch_sort: '&sort[0][field]=Airport_IATA&sort[0][direction]=asc', | |||||
selectedOrigin: { | |||||
key: '', | |||||
iata: '', | |||||
'lat-lng': [], | |||||
municipality: '' | |||||
}, | |||||
selectedDestination: { | |||||
key: '', | |||||
iata: '', | |||||
'lat-lng': [], | |||||
municipality: '' | |||||
} | |||||
} | |||||
}, | |||||
async fetch () { | |||||
let response2 = {} | |||||
let mapData2 = {} | |||||
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${this.airportFetch_filterFormula}${this.airportFetch_fields_string}${this.airportFetch_sort}`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
Authorization: 'Bearer keyJ2ht64ZSN57AG1' | |||||
} | |||||
}) | |||||
if (await response.offset) { | |||||
response2 = fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${this.airportFetch_filterFormula}&fields[]=Airport_IATA&fields[]=Icon_Url&fields[]=Latitude_Deg&fields[]=Longitude_Deg&sort[0][field]=Airport_IATA&sort[0][direction]=asc&offset=${response.offset}`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
Authorization: 'Bearer keyJ2ht64ZSN57AG1' | |||||
} | |||||
}) | |||||
mapData2 = await response2.json() | |||||
} | |||||
const mapData = await response.json() | |||||
const r1 = mapData.records | |||||
const r2 = mapData2.records | |||||
console.log(r2) | |||||
// const mapDataTotal = [...r1, ...r2] | |||||
const mapDataTotal = [...r1] | |||||
this.airports_orig = mapDataTotal.map((record) => { | |||||
return { | |||||
iata: record.fields.Airport_IATA, | |||||
lat: record.fields.Latitude_Deg, | |||||
long: record.fields.Longitude_Deg, | |||||
icon: record.fields.Icon_Url, | |||||
municipality: record.fields.Municipality, | |||||
type: record.fields.Type | |||||
} | |||||
}) | |||||
}, | |||||
computed: { | |||||
airportFetch_fields_string () { | |||||
const vm = this | |||||
const array = vm.airportFetch_fields.map((field) => { | |||||
return '&fields[]=' + field | |||||
}) | |||||
return array.join('') | |||||
}, | |||||
mapBoxApiUrl () { | |||||
return `https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=${this.mapBoxAccessToken}` | |||||
}, | |||||
tileLayer () { | |||||
return { | |||||
// url: this.mapBoxApiUrl, | |||||
maxZoom: 18, | |||||
// id: 'flylocal/ckt9x8aho0igb18mmm9ks2fsv', | |||||
tileSize: 512, | |||||
zoomOffset: -1, | |||||
accessToken: 'your.mapbox.access.token', | |||||
attribution: this.mapBoxAttribution | |||||
} | |||||
} | |||||
}, | |||||
methods: { | |||||
makeOrigin (airport) { | |||||
this.selectedOrigin = { | |||||
key: airport.iata, | |||||
iata: airport.iata, | |||||
'lat-lng': [airport.lat, airport.long], | |||||
municipality: airport.municipality | |||||
} | |||||
this.fetchDestinations(airport.iata) | |||||
}, | |||||
makeDestination (airport) { | |||||
this.selectedDestination = { | |||||
key: airport.iata, | |||||
iata: airport.iata, | |||||
'lat-lng': [airport.lat, airport.long], | |||||
municipality: airport.municipality | |||||
} | |||||
}, | |||||
clearOrigin () { | |||||
this.selectedOrigin = { | |||||
key: '', | |||||
iata: '', | |||||
'lat-lng': [], | |||||
municipality: '' | |||||
} | |||||
this.selectedDestination = { | |||||
key: '', | |||||
iata: '', | |||||
'lat-lng': [], | |||||
municipality: '' | |||||
} | |||||
}, | |||||
clearDestination () { | |||||
this.selectedDestination = { | |||||
key: '', | |||||
iata: '', | |||||
'lat-lng': [], | |||||
municipality: '' | |||||
} | |||||
}, | |||||
async fetchDestinations (iata) { | |||||
const airportFetchDestfilterFormula = `AND(Is_Destination=1,{IsCurrent-AsDest}="Yes",(FIND("${iata}", Associated_Origin_Search)>0))` | |||||
const test = `https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${airportFetchDestfilterFormula}${this.airportFetch_fields_string}${this.airportFetch_sort}` | |||||
console.log(test) | |||||
const response = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA?filterByFormula=${airportFetchDestfilterFormula}${this.airportFetch_fields_string}${this.airportFetch_sort}`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
Authorization: 'Bearer keyJ2ht64ZSN57AG1' | |||||
} | |||||
}) | |||||
const mapData = await response.json() | |||||
this.airports_dest = mapData.records.map((record) => { | |||||
return { | |||||
iata: record.fields.Airport_IATA, | |||||
lat: record.fields.Latitude_Deg, | |||||
long: record.fields.Longitude_Deg, | |||||
icon: record.fields.Icon_Url, | |||||
municipality: record.fields.Municipality, | |||||
type: record.fields.Type | |||||
} | |||||
}) | |||||
} | |||||
} | |||||
} | |||||
</script> | |||||
<style lang="css" > | |||||
:root { | |||||
--map-shadow: 5px 3px 10px rgb(0 0 0 / 20%); | |||||
} | |||||
#map-wrap { | |||||
height: 100vh; | |||||
} | |||||
.map__icon-muni { | |||||
white-space: nowrap; | |||||
} | |||||
.map__popup { | |||||
font-size: 0.9rem; | |||||
} | |||||
.map__popup-iata { | |||||
white-space: nowrap; | |||||
font-size: 3em; | |||||
line-height: 1; | |||||
} | |||||
.map__popup-muni { | |||||
white-space: nowrap; | |||||
margin-bottom: 0.5rem; | |||||
} | |||||
.map__popup-buttons { | |||||
display: flex; | |||||
flex-direction: row; | |||||
gap: 0.5em; | |||||
} | |||||
.leaflet-popup { | |||||
top: 0 !important; | |||||
left: 0 !important; | |||||
} | |||||
.leaflet-popup-content-wrapper { | |||||
border-radius: 0.2rem 1.5rem 1.5rem 1.5rem; | |||||
box-shadow: var(--map-shadow); | |||||
} | |||||
.leaflet-popup-tip-container, | |||||
.leaflet-popup-close-button { | |||||
display: none; | |||||
} | |||||
.leaflet-popup-content { | |||||
margin: 0.75rem; | |||||
} | |||||
.airport-icon { | |||||
padding: 0.55rem; | |||||
border-radius: 0.2rem 1.5rem 1.5rem 1.5rem; | |||||
box-shadow: var(--map-shadow); | |||||
text-align: center; | |||||
width: auto !important; | |||||
height: auto !important; | |||||
margin: 0 !important; | |||||
border: 0.2rem solid transparent; | |||||
transition: all 0.2s; | |||||
} | |||||
.airport-icon.orig-icon { | |||||
background-color: white; | |||||
color: black; | |||||
} | |||||
.airport-icon.orig-icon:hover { | |||||
border-color: #007fff; | |||||
} | |||||
.airport-icon.dest-icon { | |||||
background-color: #ddd; | |||||
color: black; | |||||
} | |||||
.airport-icon.orig-icon.selected { | |||||
border-color: #007fff; | |||||
} | |||||
.airport-icon.dest-icon:hover { | |||||
background-color: #007fff; | |||||
color: white; | |||||
} | |||||
.airport-icon.dest-icon.selected { | |||||
background-color: #007fff; | |||||
color: white; | |||||
} | |||||
#map-wrap .marker-cluster-small { | |||||
background-color: rgba(47, 151, 255, 0.15); | |||||
} | |||||
#map-wrap .marker-cluster-small div { | |||||
background-color: rgba(0, 127, 255, 0.15); | |||||
} | |||||
#map-wrap .marker-cluster-medium { | |||||
background-color: rgba(47, 151, 255, 0.5); | |||||
} | |||||
#map-wrap .marker-cluster-medium div { | |||||
background-color: rgba(0, 127, 255, 0.5); | |||||
} | |||||
#map-wrap .marker-cluster-large { | |||||
background-color: rgba(47, 151, 255, 0.9); | |||||
} | |||||
#map-wrap .marker-cluster-large div { | |||||
background-color: rgba(0, 127, 255, 0.9); | |||||
} | |||||
/* .marker-cluster { | |||||
background-clip: padding-box; | |||||
border-radius: 20px; | |||||
} | |||||
.marker-cluster div { | |||||
width: 30px; | |||||
height: 30px; | |||||
margin-left: 5px; | |||||
margin-top: 5px; | |||||
text-align: center; | |||||
border-radius: 15px; | |||||
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif; | |||||
} | |||||
.marker-cluster span { | |||||
line-height: 30px; | |||||
} */ | |||||
.btn { | |||||
border-radius: 999px; | |||||
padding: 0.4em 0.8em; | |||||
font-size: 1rem; | |||||
white-space: nowrap; | |||||
transition: 0.2s all; | |||||
} | |||||
.btn.btn--primary { | |||||
background: #007fff; | |||||
color: #fff; | |||||
} | |||||
.btn.btn--primary:hover { | |||||
background: #72b9ff; | |||||
color: #fff; | |||||
} | |||||
.btn.btn--cancel { | |||||
background: red; | |||||
color: #fff; | |||||
} | |||||
.btn.btn--cancel:hover { | |||||
background: rgb(255, 83, 83); | |||||
color: #fff; | |||||
} | |||||
.btn.btn--secondary { | |||||
background: #ccc; | |||||
color: #000; | |||||
} | |||||
.btn.btn--secondary:hover { | |||||
background: rgb(151, 151, 151); | |||||
color: #000; | |||||
} | |||||
/* .btn.btn--map { | |||||
//.. | |||||
} */ | |||||
</style> |
@ -0,0 +1,11 @@ | |||||
<template> | |||||
<svg class="nuxt-logo" viewBox="0 0 45 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | |||||
<path d="M24.7203 29.704H41.1008C41.6211 29.7041 42.1322 29.5669 42.5828 29.3061C43.0334 29.0454 43.4075 28.6704 43.6675 28.2188C43.9275 27.7672 44.0643 27.2549 44.0641 26.7335C44.0639 26.2121 43.9266 25.6999 43.6662 25.2485L32.6655 6.15312C32.4055 5.70162 32.0315 5.32667 31.581 5.06598C31.1305 4.8053 30.6195 4.66805 30.0994 4.66805C29.5792 4.66805 29.0682 4.8053 28.6177 5.06598C28.1672 5.32667 27.7932 5.70162 27.5332 6.15312L24.7203 11.039L19.2208 1.48485C18.9606 1.03338 18.5864 0.658493 18.1358 0.397853C17.6852 0.137213 17.1741 0 16.6538 0C16.1336 0 15.6225 0.137213 15.1719 0.397853C14.7213 0.658493 14.3471 1.03338 14.0868 1.48485L0.397874 25.2485C0.137452 25.6999 0.000226653 26.2121 2.8053e-07 26.7335C-0.000226092 27.2549 0.136554 27.7672 0.396584 28.2188C0.656614 28.6704 1.03072 29.0454 1.48129 29.3061C1.93185 29.5669 2.44298 29.7041 2.96326 29.704H13.2456C17.3195 29.704 20.3239 27.9106 22.3912 24.4118L27.4102 15.7008L30.0986 11.039L38.1667 25.0422H27.4102L24.7203 29.704ZM13.0779 25.0374L5.9022 25.0358L16.6586 6.36589L22.0257 15.7008L18.4322 21.9401C17.0593 24.2103 15.4996 25.0374 13.0779 25.0374Z" fill="#00DC82" /> | |||||
</svg> | |||||
</template> | |||||
<style> | |||||
.nuxt-logo { | |||||
height: 180px; | |||||
} | |||||
</style> |
@ -0,0 +1,178 @@ | |||||
<template> | |||||
<div class="picker-wrap"> | |||||
<v-select :options="testlist" label="slug"> | |||||
<template #option="option"> | |||||
<span>{{ option.slug }}</span> | |||||
<span>{{ option.title }}</span> | |||||
</template> | |||||
</v-select> | |||||
<v-select :options="airports" label="iata" :filter-by="filterBy" @input="setSelectedOrigin"> | |||||
<template #no-options="{ search, searching }"> | |||||
<template v-if="searching"> | |||||
No results found for <em>{{ search }}</em>. | |||||
</template> | |||||
<em v-else style="opacity: 0.5;">Start typing to search for an airport.</em> | |||||
</template> | |||||
<template #option="option"> | |||||
<div class="picker-item"> | |||||
<div class="picker-item__section"> | |||||
<div class="picker-item__iata"> | |||||
{{ option.iata }} | |||||
</div> | |||||
</div> | |||||
<div class="picker-item__section"> | |||||
<div class="picker-item__name"> | |||||
{{ option.name }} | |||||
</div> | |||||
<div class="picker-item__muni"> | |||||
{{ option.municipality }} | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</template> | |||||
</v-select> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
export default { | |||||
props: { | |||||
testlist: { | |||||
type: [Array, Object], | |||||
default () { | |||||
return [] | |||||
} | |||||
} | |||||
}, | |||||
data () { | |||||
return { | |||||
mountains: [], | |||||
airports: [], | |||||
airportFetch_url: 'https://api.airtable.com/v0/appiQwfVZixRgRICe/Airports_IATA', | |||||
airportFetch_filterFormula: 'AND(Is_Origin=1,{IsCurrent-AsOrigin}=\'Yes\')', | |||||
airportFetch_fields: [ | |||||
'Airport_IATA', | |||||
'Icon_Url', | |||||
'Latitude_Deg', | |||||
'Longitude_Deg', | |||||
'Municipality', | |||||
'Airport_Name', | |||||
'Type', | |||||
'Search_Field' | |||||
], | |||||
airportFetch_sort: '&sort[0][field]=Airport_IATA&sort[0][direction]=asc', | |||||
filterBy: (option, label, search) => { | |||||
const temp = search.toLowerCase() | |||||
return option.search.toLowerCase().includes(temp) | |||||
}, | |||||
selectedOrigin: {}, | |||||
selectedDestination: {} | |||||
} | |||||
}, | |||||
async fetch () { | |||||
let response2 = {} | |||||
let mapData2 = {} | |||||
const response = await fetch(`${this.airportFetch_url}?filterByFormula=${this.airportFetch_filterFormula}${this.airportFetch_fields_string}${this.airportFetch_sort}`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
Authorization: 'Bearer keyJ2ht64ZSN57AG1' | |||||
} | |||||
}) | |||||
if (await response.offset) { | |||||
response2 = fetch(`${this.airportFetch_url}?filterByFormula=${this.filterFormula}${this.airportFetch_fields_string}${this.airportFetch_sort}&offset=${response.offset}`, { | |||||
method: 'GET', | |||||
headers: { | |||||
'Content-Type': 'application/x-www-form-urlencoded', | |||||
Authorization: 'Bearer keyJ2ht64ZSN57AG1' | |||||
} | |||||
}) | |||||
mapData2 = await response2.json() | |||||
} | |||||
const mapData = await response.json() | |||||
const r1 = mapData.records | |||||
const r2 = mapData2.records | |||||
console.log(r2) | |||||
// const mapDataTotal = [...r1, ...r2] | |||||
const mapDataTotal = [...r1] | |||||
this.airports = mapDataTotal.map((record) => { | |||||
return { | |||||
iata: record.fields.Airport_IATA, | |||||
lat: record.fields.Latitude_Deg, | |||||
long: record.fields.Longitude_Deg, | |||||
icon: record.fields.Icon_Url, | |||||
name: record.fields.Airport_Name, | |||||
municipality: record.fields.Municipality, | |||||
type: record.fields.Type, | |||||
search: record.fields.Search_Field | |||||
} | |||||
}) | |||||
}, | |||||
computed: { | |||||
airportFetch_fields_string () { | |||||
const vm = this | |||||
const array = vm.airportFetch_fields.map((field) => { | |||||
return '&fields[]=' + field | |||||
}) | |||||
return array.join('') | |||||
} | |||||
}, | |||||
methods: { | |||||
setSelectedOrigin (value) { | |||||
this.selectedOrigin = value | |||||
this.$router.push('/go/' + value.iata) | |||||
}, | |||||
setSelectedDestination (value) { | |||||
this.selectedDestination = value | |||||
this.$router.push('/go/' + this.selectedOrigin + '/' + value.iata) | |||||
} | |||||
} | |||||
} | |||||
</script> | |||||
<style> | |||||
html { | |||||
color: black; | |||||
} | |||||
.picker-wrap { | |||||
margin: 1rem; | |||||
} | |||||
.vs__search { | |||||
font-size: 2rem !important; | |||||
} | |||||
.picker-item { | |||||
padding: 0.5rem; | |||||
display: flex; | |||||
flex-direction: row; | |||||
align-items: center; | |||||
gap: 1rem; | |||||
} | |||||
.picker-item__section { | |||||
display: flex; | |||||
flex-direction: column; | |||||
} | |||||
.picker-item__name { | |||||
font-size: 1rem; | |||||
} | |||||
.picker-item__muni { | |||||
color: blue; | |||||
} | |||||
.picker-item__iata { | |||||
font-size: 3rem; | |||||
} | |||||
</style> |
@ -0,0 +1,46 @@ | |||||
<!-- Please remove this file from your project --> | |||||
<template> | |||||
<div class="relative flex items-top justify-center min-h-screen bg-gray-100 sm:items-center sm:pt-0"> | |||||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.1.2/dist/tailwind.min.css" rel="stylesheet"> | |||||
<div class="max-w-4xl mx-auto sm:px-6 lg:px-8"> | |||||
<a class="flex justify-center pt-8 sm:pt-0" href="https://nuxtjs.org" target="_blank"> | |||||
<svg width="218" height="45" viewBox="0 0 159 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M55.5017 6.81866H60.1727L70.0719 22.9912V6.81866H74.3837V29.7345H69.7446L59.8135 13.5955V29.7345H55.5017V6.81866Z" fill="#003543" /> <path d="M93.657 29.7344H89.6389V27.1747C88.7241 28.9761 86.8628 29.9904 84.5113 29.9904C80.7869 29.9904 78.3684 27.3059 78.3684 23.4423V13.2339H82.3865V22.5976C82.3865 24.8566 83.7594 26.4276 85.8171 26.4276C88.0712 26.4276 89.6389 24.6598 89.6389 22.2377V13.2339H93.657V29.7344Z" fill="#003543" /> <path d="M107.64 29.7344L103.784 24.2342L99.9291 29.7344H95.6492L101.596 21.1242L96.1074 13.2339H100.485L103.784 17.9821L107.051 13.2339H111.461L105.94 21.1242L111.886 29.7344H107.64Z" fill="#003543" /> <path d="M120.053 8.25848V13.2339H124.627V16.6063H120.053V24.7974C120.053 25.0725 120.162 25.3363 120.356 25.531C120.55 25.7257 120.813 25.8353 121.087 25.8357H124.627V29.728H121.98C118.386 29.728 116.035 27.6323 116.035 23.9687V16.6095H112.801V13.2339H114.83C115.776 13.2339 116.327 12.6692 116.327 11.7349V8.25848H120.053Z" fill="#003543" /> <path d="M134.756 24.5446V6.81866H139.066V23.1864C139.066 27.6067 136.943 29.7345 133.349 29.7345H128.332V25.8421H133.461C133.804 25.8421 134.134 25.7054 134.377 25.4621C134.619 25.2188 134.756 24.8888 134.756 24.5446Z" fill="#003543" /> <path d="M141.649 22.0409H145.799C146.029 24.6006 147.728 26.2308 150.472 26.2308C152.923 26.2308 154.623 25.2501 154.623 23.2199C154.623 18.3085 142.331 21.7129 142.331 12.9395C142.334 9.17515 145.568 6.55945 150.215 6.55945C155.05 6.55945 158.317 9.34153 158.516 13.6306H154.388C154.193 11.6341 152.632 10.2918 150.207 10.2918C147.953 10.2918 146.548 11.3397 146.548 12.9427C146.548 18.0173 159 14.2226 159 23.1576C159 27.4131 155.504 30 150.474 30C145.279 30 141.882 26.8563 141.654 22.0441" fill="#003543" /> <path d="M24.7203 29.704H41.1008C41.6211 29.7041 42.1322 29.5669 42.5828 29.3061C43.0334 29.0454 43.4075 28.6704 43.6675 28.2188C43.9275 27.7672 44.0643 27.2549 44.0641 26.7335C44.0639 26.2121 43.9266 25.6999 43.6662 25.2485L32.6655 6.15312C32.4055 5.70162 32.0315 5.32667 31.581 5.06598C31.1305 4.8053 30.6195 4.66805 30.0994 4.66805C29.5792 4.66805 29.0682 4.8053 28.6177 5.06598C28.1672 5.32667 27.7932 5.70162 27.5332 6.15312L24.7203 11.039L19.2208 1.48485C18.9606 1.03338 18.5864 0.658493 18.1358 0.397853C17.6852 0.137213 17.1741 0 16.6538 0C16.1336 0 15.6225 0.137213 15.1719 0.397853C14.7213 0.658493 14.3471 1.03338 14.0868 1.48485L0.397874 25.2485C0.137452 25.6999 0.000226653 26.2121 2.8053e-07 26.7335C-0.000226092 27.2549 0.136554 27.7672 0.396584 28.2188C0.656614 28.6704 1.03072 29.0454 1.48129 29.3061C1.93185 29.5669 2.44298 29.7041 2.96326 29.704H13.2456C17.3195 29.704 20.3239 27.9106 22.3912 24.4118L27.4102 15.7008L30.0986 11.039L38.1667 25.0422H27.4102L24.7203 29.704ZM13.0779 25.0374L5.9022 25.0358L16.6586 6.36589L22.0257 15.7008L18.4322 21.9401C17.0593 24.2103 15.4996 25.0374 13.0779 25.0374Z" fill="#00DC82" /></svg> | |||||
</a> | |||||
<div class="mt-8 bg-white overflow-hidden shadow sm:rounded-lg p-6"> | |||||
<h2 class="text-2xl leading-7 font-semibold"> | |||||
Welcome to your Nuxt Application | |||||
</h2> | |||||
<p class="mt-3 text-gray-600"> | |||||
We recommend you take a look at the <a href="https://nuxtjs.org" target="_blank" class="text-green-500 hover:underline">Nuxt documentation</a>, whether you are new or have previous experience with the framework.<br> | |||||
</p> | |||||
<p class="mt-4 pt-4 text-gray-800 border-t border-dashed"> | |||||
To get started, remove <code class="bg-gray-100 text-sm p-1 rounded border">components/Tutorial.vue</code> and start coding in <code class="bg-gray-100 text-sm p-1 rounded border">pages/index.vue</code>. Have fun! | |||||
</p> | |||||
</div> | |||||
<div class="flex justify-center pt-4 space-x-2"> | |||||
<a href="https://github.com/nuxt/nuxt.js" target="_blank"><svg | |||||
class="w-6 h-6 text-gray-600 hover:text-gray-800" | |||||
xmlns="http://www.w3.org/2000/svg" | |||||
xmlns:xlink="http://www.w3.org/1999/xlink" | |||||
aria-hidden="true" | |||||
role="img" | |||||
width="32" | |||||
height="32" | |||||
preserveAspectRatio="xMidYMid meet" | |||||
viewBox="0 0 24 24" | |||||
><path d="M12 2.247a10 10 0 0 0-3.162 19.487c.5.088.687-.212.687-.475c0-.237-.012-1.025-.012-1.862c-2.513.462-3.163-.613-3.363-1.175a3.636 3.636 0 0 0-1.025-1.413c-.35-.187-.85-.65-.013-.662a2.001 2.001 0 0 1 1.538 1.025a2.137 2.137 0 0 0 2.912.825a2.104 2.104 0 0 1 .638-1.338c-2.225-.25-4.55-1.112-4.55-4.937a3.892 3.892 0 0 1 1.025-2.688a3.594 3.594 0 0 1 .1-2.65s.837-.262 2.75 1.025a9.427 9.427 0 0 1 5 0c1.912-1.3 2.75-1.025 2.75-1.025a3.593 3.593 0 0 1 .1 2.65a3.869 3.869 0 0 1 1.025 2.688c0 3.837-2.338 4.687-4.563 4.937a2.368 2.368 0 0 1 .675 1.85c0 1.338-.012 2.413-.012 2.75c0 .263.187.575.687.475A10.005 10.005 0 0 0 12 2.247z" fill="currentColor" /></svg></a> | |||||
<a href="https://twitter.com/nuxt_js" target="_blank"><svg | |||||
class="w-6 h-6 text-gray-600 hover:text-gray-800" | |||||
xmlns="http://www.w3.org/2000/svg" | |||||
xmlns:xlink="http://www.w3.org/1999/xlink" | |||||
aria-hidden="true" | |||||
role="img" | |||||
width="32" | |||||
height="32" | |||||
preserveAspectRatio="xMidYMid meet" | |||||
viewBox="0 0 24 24" | |||||
><path d="M22.46 6c-.77.35-1.6.58-2.46.69c.88-.53 1.56-1.37 1.88-2.38c-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29c0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15c0 1.49.75 2.81 1.91 3.56c-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07a4.28 4.28 0 0 0 4 2.98a8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21C16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56c.84-.6 1.56-1.36 2.14-2.23z" fill="currentColor" /></svg></a> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</template> |
@ -0,0 +1,83 @@ | |||||
export default { | |||||
// Global page headers: https://go.nuxtjs.dev/config-head | |||||
head: { | |||||
title: 'flylocal-v5-nuxt', | |||||
meta: [ | |||||
{ charset: 'utf-8' }, | |||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }, | |||||
{ hid: 'description', name: 'description', content: '' }, | |||||
{ name: 'format-detection', content: 'telephone=no' } | |||||
], | |||||
link: [ | |||||
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } | |||||
] | |||||
}, | |||||
// Global CSS: https://go.nuxtjs.dev/config-css | |||||
css: [ | |||||
], | |||||
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins | |||||
plugins: [ | |||||
{ src: '~/plugins/vue2-leaflet-markercluster.js', mode: 'client' } | |||||
], | |||||
// Auto import components: https://go.nuxtjs.dev/config-components | |||||
components: true, | |||||
router: { | |||||
extendRoutes (routes, resolve) { | |||||
routes.push( | |||||
{ | |||||
name: 'go-orig-dest', | |||||
path: '/go/*/*', | |||||
component: resolve(__dirname, 'pages/go.vue') | |||||
}, | |||||
{ | |||||
name: 'go-orig', | |||||
path: '/go/*', | |||||
component: resolve(__dirname, 'pages/go.vue') | |||||
} | |||||
) | |||||
} | |||||
}, | |||||
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules | |||||
buildModules: [ | |||||
// https://go.nuxtjs.dev/eslint | |||||
'@nuxtjs/eslint-module', | |||||
// https://go.nuxtjs.dev/stylelint | |||||
'@nuxtjs/stylelint-module', | |||||
// https://go.nuxtjs.dev/tailwindcss | |||||
'@nuxtjs/tailwindcss' | |||||
], | |||||
// Modules: https://go.nuxtjs.dev/config-modules | |||||
modules: [ | |||||
// https://go.nuxtjs.dev/axios | |||||
'@nuxtjs/axios', | |||||
// https://go.nuxtjs.dev/pwa | |||||
'@nuxtjs/pwa', | |||||
'nuxt-leaflet', | |||||
'nuxt-vue-select' | |||||
], | |||||
// Axios module configuration: https://go.nuxtjs.dev/config-axios | |||||
axios: {}, | |||||
// PWA module configuration: https://go.nuxtjs.dev/pwa | |||||
pwa: { | |||||
manifest: { | |||||
lang: 'en' | |||||
} | |||||
}, | |||||
// Build Configuration: https://go.nuxtjs.dev/config-build | |||||
build: { | |||||
extend (config, ctx) { | |||||
if (ctx.isDev) { | |||||
config.devtool = ctx.isClient ? 'source-map' : 'inline-source-map' | |||||
} | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,44 @@ | |||||
{ | |||||
"name": "flylocal-v5-nuxt", | |||||
"version": "1.0.0", | |||||
"private": true, | |||||
"scripts": { | |||||
"dev": "nuxt", | |||||
"build": "nuxt build", | |||||
"start": "nuxt start", | |||||
"generate": "nuxt generate", | |||||
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .", | |||||
"lint:style": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore", | |||||
"lint": "yarn lint:js && yarn lint:style" | |||||
}, | |||||
"dependencies": { | |||||
"@nuxtjs/axios": "^5.13.6", | |||||
"@nuxtjs/pwa": "^3.3.5", | |||||
"airtable": "^0.11.1", | |||||
"autoprefixer": "^10.3.4", | |||||
"core-js": "^3.15.1", | |||||
"leaflet": "^1.7.1", | |||||
"node-sass": "^6.0.1", | |||||
"nuxt": "^2.15.7", | |||||
"nuxt-leaflet": "^0.0.25", | |||||
"nuxt-vue-select": "^0.1.4", | |||||
"sass-loader": "^12.1.0", | |||||
"tailwindcss": "^2.2.15", | |||||
"vue-select": "^3.13.0", | |||||
"vue2-leaflet": "^2.7.1", | |||||
"vue2-leaflet-markercluster": "^3.1.0" | |||||
}, | |||||
"devDependencies": { | |||||
"@babel/eslint-parser": "^7.14.7", | |||||
"@nuxtjs/eslint-config": "^6.0.1", | |||||
"@nuxtjs/eslint-module": "^3.0.2", | |||||
"@nuxtjs/stylelint-module": "^4.0.0", | |||||
"@nuxtjs/tailwindcss": "^4.2.1", | |||||
"eslint": "^7.29.0", | |||||
"eslint-plugin-nuxt": "^2.0.0", | |||||
"eslint-plugin-vue": "^7.12.1", | |||||
"postcss": "^8.3.6", | |||||
"stylelint": "^13.13.1", | |||||
"stylelint-config-standard": "^22.0.0" | |||||
} | |||||
} |
@ -0,0 +1,33 @@ | |||||
<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> |
@ -0,0 +1,80 @@ | |||||
<template> | |||||
<main> | |||||
<header> | |||||
<div> | |||||
logo | |||||
</div> | |||||
<div> | |||||
<span> | |||||
click the map, or | |||||
<button class="btn btn--primary" @click="showPicker"> | |||||
search | |||||
</button> | |||||
</span> | |||||
</div> | |||||
</header> | |||||
<Map /> | |||||
<aside class="nav"> | |||||
<PickerOrigin v-show="isPickerVisible" :testlist="mountains" /> | |||||
</aside> | |||||
</main> | |||||
</template> | |||||
<script> | |||||
import PickerOrigin from '../components/PickerOrigin.vue' | |||||
export default { | |||||
components: { PickerOrigin }, | |||||
data () { | |||||
return { | |||||
mountains: [ | |||||
{ | |||||
slug: 'sluggy', | |||||
title: 'titly' | |||||
} | |||||
], | |||||
isPickerVisible: false | |||||
} | |||||
}, | |||||
async fetch () { | |||||
this.mountains = await fetch( | |||||
'https://api.nuxtjs.dev/mountains' | |||||
).then(res => res.json()) | |||||
}, | |||||
methods: { | |||||
showPicker () { | |||||
this.isPickerVisible = !this.isPickerVisible | |||||
} | |||||
} | |||||
} | |||||
</script> | |||||
<style scoped> | |||||
header { | |||||
position: fixed; | |||||
top: 0; | |||||
width: 100vw; | |||||
z-index: 402; | |||||
display: flex; | |||||
flex-direction: row; | |||||
padding: 1rem; | |||||
} | |||||
.nav { | |||||
position: fixed; | |||||
top: 0; | |||||
padding-top: 4rem; | |||||
width: 100vw; | |||||
z-index: 401; | |||||
background: white; | |||||
display: flex; | |||||
flex-direction: column; | |||||
justify-items: center; | |||||
} | |||||
.btn--nav-open { | |||||
padding: 1rem; | |||||
display: block; | |||||
} | |||||
</style> |
@ -0,0 +1,13 @@ | |||||
<template> | |||||
<main> | |||||
<h1>Home page</h1> | |||||
<NuxtLink to="/go"> | |||||
Go! | |||||
</NuxtLink> | |||||
<a href="https://nuxtjs.org">External Link to another page</a> | |||||
</main> | |||||
</template> | |||||
<script> | |||||
export default {} | |||||
</script> |
@ -0,0 +1,20 @@ | |||||
<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> |
@ -0,0 +1,16 @@ | |||||
import Vue from 'vue' | |||||
import * as L from 'leaflet' | |||||
import Vue2LeafletMarkerCluster from 'vue2-leaflet-markercluster' | |||||
import 'leaflet/dist/leaflet.css' | |||||
import 'leaflet.markercluster/dist/MarkerCluster.css' | |||||
import 'leaflet.markercluster/dist/MarkerCluster.Default.css' | |||||
Vue.component('v-marker-cluster', Vue2LeafletMarkerCluster) | |||||
const LeafletPlugin = { | |||||
install (Vue) { | |||||
Vue.prototype.$L = L | |||||
} | |||||
} | |||||
Vue.use(LeafletPlugin) |
@ -0,0 +1,10 @@ | |||||
# STORE | |||||
**This directory is not required, you can delete it if you don't want to use it.** | |||||
This directory contains your Vuex Store files. | |||||
Vuex Store option is implemented in the Nuxt.js framework. | |||||
Creating a file in this directory automatically activates the option in the framework. | |||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). |
@ -0,0 +1,8 @@ | |||||
module.exports = { | |||||
extends: [ | |||||
'stylelint-config-standard' | |||||
], | |||||
// add your custom config here | |||||
// https://stylelint.io/user-guide/configuration | |||||
rules: {} | |||||
} |