Skip to content

Commit

Permalink
chore: add linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ludchieng committed Jan 24, 2023
1 parent 1890bbb commit c9405fa
Show file tree
Hide file tree
Showing 23 changed files with 292 additions and 122 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = {
},
extends: [
'plugin:vue/essential',
'plugin:vue/strongly-recommended',
'plugin:vue/recommended',
'@vue/standard',
'@vue/typescript/recommended',
],
Expand Down
14 changes: 7 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ export default Vue.extend({
components: {
AppView,
},
created () {
if (!lastUpdatedAt()) {
synchronize().then(() => {
window.location.href = '/'
})
}
},
watch: {
'$route.params.tab': {
handler () {
Expand Down Expand Up @@ -71,6 +64,13 @@ export default Vue.extend({
immediate: true,
},
},
created () {
if (!lastUpdatedAt()) {
synchronize().then(() => {
window.location.href = '/'
})
}
},
})
</script>

Expand Down
23 changes: 15 additions & 8 deletions src/components/AppHeader.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
<template>
<header>
<div>
<router-link v-if="$route.params.line"
<router-link
v-if="$route.params.line"
class="icon-line"
:to="`/timetables/${ $route.params.tab }/${ $route.params.line }`"
>
<LineIcon
:lineSlugName="$route.params.line"
color="colors"
size="md"
/>
<LineIcon
:line-slug-name="$route.params.line"
color="colors"
size="md"
/>
</router-link>
</div>
<div>
<router-link class="logo" :to="`/timetables/${ $route.params.tab || '' }`">
<img alt="Logo Alednavigo" src="@/assets/icon-light.png" />
<router-link
class="logo"
:to="`/timetables/${ $route.params.tab || '' }`"
>
<img
alt="Logo Alednavigo"
src="@/assets/icon-light.png"
>
</router-link>
</div>
<div class="clock">
Expand Down
70 changes: 54 additions & 16 deletions src/components/AppNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@
<nav>
<hr>
<div class="nav-content">
<div v-if="showTabsList" class="nav-tabs-list">
<div
v-if="showTabsList"
class="nav-tabs-list"
>
<ul>
<li v-for="({ line, stop, path }, i) in $store.state.tabs" :key="`/${i + 1}/${path}`"
<li
v-for="({ line, stop, path }, i) in $store.state.tabs"
:key="`/${i + 1}/${path}`"
class="tab"
:class="{ 'tab-active': tabIndex() === i }"
>
<router-link class="tab-link" :to="`/timetables/${i + 1}/${path}`">
<router-link
class="tab-link"
:to="`/timetables/${i + 1}/${path}`"
>
<span class="tab-label">
<LineIcon
:lineSlugName="line"
:line-slug-name="line"
:color="tabIndex() === i ? 'dark' : 'light'"
size="sm"
/>
<span v-if="stop" class="tab-label-text">
<span
v-if="stop"
class="tab-label-text"
>
{{ getStop(line, stop).displayName }}
</span>
</span>
</router-link>
<button v-if="$store.state.tabs.length > 1"
<button
v-if="$store.state.tabs.length > 1"
class="close-tab"
@click="closeTab(i)"
>
Expand All @@ -31,35 +43,61 @@
</div>

<div class="nav-controls">
<router-link class="to-settings" to="/settings">
<img class="icon-settings" src="/img/mui/more-vert.svg" />
<router-link
class="to-settings"
to="/settings"
>
<img
class="icon-settings"
src="/img/mui/more-vert.svg"
>
</router-link>
<div class="tabs-manager">
<ul v-if="!showTabsList" class="tabs">
<li v-for="({ line, stop, path }, i) in $store.state.tabs" :key="`/${i + 1}/${path}`"
<ul
v-if="!showTabsList"
class="tabs"
>
<li
v-for="({ line, stop, path }, i) in $store.state.tabs"
:key="`/${i + 1}/${path}`"
class="tab"
:class="{ 'tab-active': tabIndex() === i }"
>
<router-link class="tab-link" :to="`/timetables/${i + 1}/${path}`">
<router-link
class="tab-link"
:to="`/timetables/${i + 1}/${path}`"
>
<span class="tab-label">
<LineIcon
:lineSlugName="line"
:line-slug-name="line"
:color="tabIndex() === i ? 'dark' : 'light'"
size="sm"
/>
<span v-if="stop" class="tab-label-text">
<span
v-if="stop"
class="tab-label-text"
>
{{ getStop(line, stop).displayName }}
</span>
</span>
</router-link>
</li>
</ul>
</div>
<button class="add-tab" @click="addTab()">
<button
class="add-tab"
@click="addTab()"
>
+
</button>
<button class="btn-toggle-tabs-list" @click="showTabsList = !showTabsList">
<img class="icon-tabs-list" src="/img/mui/reorder.svg" />
<button
class="btn-toggle-tabs-list"
@click="showTabsList = !showTabsList"
>
<img
class="icon-tabs-list"
src="/img/mui/reorder.svg"
>
</button>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/AppView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<div>
<AppHeader />
<div class="tab">
<router-view>
</router-view>
<router-view />
</div>
<AppNav />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/LineIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:src="`/img/lines-icons/${color}/${lineSlugName}.svg`"
:alt="`${lineSlugName}`"
:size="size"
:fadeIn="fadeIn"
:fade-in="fadeIn"
/>
</template>

Expand Down
12 changes: 6 additions & 6 deletions src/components/LineMap/LineMap.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<LineMapTable
:line="line"
:routeMap="routeMap"
:route-map="routeMap"
/>
</template>

Expand All @@ -20,6 +20,11 @@ export default Vue.extend({
data: () => ({
routeMap: [] as RouteMapType,
}),
watch: {
line () {
this.update()
},
},
created () {
this.update()
},
Expand All @@ -28,11 +33,6 @@ export default Vue.extend({
this.routeMap = getLineRouteMap(this.line)
},
},
watch: {
line () {
this.update()
},
},
})
</script>

Expand Down
86 changes: 73 additions & 13 deletions src/components/LineMap/LineMapDrawingCell.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,108 @@
<template>
<svg v-if="content === '*'" class="drawing-stop" viewBox="0 0 16 16">
<circle v-if="isLargeCircle" cx="8" cy="8" r="6"/>
<circle v-else cx="8" cy="8" r="4"/>
<svg
v-if="content === '*'"
class="drawing-stop"
viewBox="0 0 16 16"
>
<circle
v-if="isLargeCircle"
cx="8"
cy="8"
r="6"
/>
<circle
v-else
cx="8"
cy="8"
r="4"
/>
</svg>

<svg v-else-if="content === '^'" class="drawing-path" viewBox="0 0 16 16">
<svg
v-else-if="content === '^'"
class="drawing-path"
viewBox="0 0 16 16"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,0 Z" />
<path d="M0,8 a8,-8 0 0,1 8,-8 L0,0 Z" />
</svg>

<svg v-else-if="content === 'v'" class="drawing-path" viewBox="0 0 16 16">
<svg
v-else-if="content === 'v'"
class="drawing-path"
viewBox="0 0 16 16"
>
<path d="M0,8 a8,8 0 0,0 8,8 L0,16 Z" />
<path d="M8,16 a8,-8 0 0,0 8,-8 L16,16 Z" />
</svg>

<svg v-else-if="content === 'o\\'" class="drawing-path" viewBox="0 0 16 16">
<svg
v-else-if="content === 'o\\'"
class="drawing-path"
viewBox="0 0 16 16"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,0 Z" />
</svg>

<svg v-else-if="content === 'o/'" class="drawing-path" viewBox="0 0 16 16" transform="rotate(90)">
<svg
v-else-if="content === 'o/'"
class="drawing-path"
viewBox="0 0 16 16"
transform="rotate(90)"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,0 Z" />
</svg>

<svg v-else-if="content === '\\o'" class="drawing-path" viewBox="0 0 16 16" transform="rotate(180)">
<svg
v-else-if="content === '\\o'"
class="drawing-path"
viewBox="0 0 16 16"
transform="rotate(180)"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,0 Z" />
</svg>

<svg v-else-if="content === '/o'" class="drawing-path" viewBox="0 0 16 16" transform="rotate(270)">
<svg
v-else-if="content === '/o'"
class="drawing-path"
viewBox="0 0 16 16"
transform="rotate(270)"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,0 Z" />
</svg>

<svg v-else-if="content === '\\.'" class="drawing-path" viewBox="0 0 16 16">
<svg
v-else-if="content === '\\.'"
class="drawing-path"
viewBox="0 0 16 16"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,16 L0,16 L0 0 Z" />
</svg>

<svg v-else-if="content === '/.'" class="drawing-path" viewBox="0 0 16 16" transform="rotate(90)">
<svg
v-else-if="content === '/.'"
class="drawing-path"
viewBox="0 0 16 16"
transform="rotate(90)"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,16 L0,16 L0 0 Z" />
</svg>

<svg v-else-if="content === '.\\'" class="drawing-path" viewBox="0 0 16 16" transform="rotate(180)">
<svg
v-else-if="content === '.\\'"
class="drawing-path"
viewBox="0 0 16 16"
transform="rotate(180)"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,16 L0,16 L0 0 Z" />
</svg>

<svg v-else-if="content === './'" class="drawing-path" viewBox="0 0 16 16" transform="rotate(270)">
<svg
v-else-if="content === './'"
class="drawing-path"
viewBox="0 0 16 16"
transform="rotate(270)"
>
<path d="M8,0 a8,8 0 0,1 8,8 L16,16 L0,16 L0 0 Z" />
</svg>

Expand Down
12 changes: 8 additions & 4 deletions src/components/LineMap/LineMapLabelCell.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<router-link v-if="href"
<router-link
v-if="href"
class="label-text"
:to="href"
>
Expand All @@ -8,15 +9,18 @@
<LineIcon
v-for="conn in lineConnections"
:key="`${conn.line}/${conn.slugName}`"
:lineSlugName="conn.line"
:line-slug-name="conn.line"
color="colors"
size="sm"
fadeIn
fade-in
/>
</div>
</router-link>

<div v-else class="label-text">
<div
v-else
class="label-text"
>
{{ stopName }}
<div class="line-connections">
<img
Expand Down
Loading

0 comments on commit c9405fa

Please sign in to comment.