Skip to content

Commit 3a1d75f

Browse files
committed
fix bugs
1 parent 353fc19 commit 3a1d75f

File tree

18 files changed

+11385
-9745
lines changed

18 files changed

+11385
-9745
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,45 @@ name: Test
22

33
on:
44
push:
5-
merge_group:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, synchronize]
68

79
jobs:
810
lint:
911
runs-on: ubuntu-20.04
1012
steps:
1113
- uses: actions/checkout@v3
1214

13-
- uses: actions/setup-node@v3
15+
- name: Install Node.js
16+
uses: actions/setup-node@v3
1417
with:
15-
node-version: 16
18+
node-version: 16
1619

17-
- name: Get yarn cache directory path
18-
id: yarn
19-
run: echo "::set-output name=dir::$(yarn cache dir)"
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v2
22+
with:
23+
version: 8
24+
run_install: false
25+
26+
- name: Get pnpm store directory
27+
shell: bash
28+
run: |
29+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
2030
2131
- uses: actions/cache@v3
32+
name: Setup pnpm cache
2233
with:
23-
path: ${{ steps.yarn.outputs.dir }}
24-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
25-
restore-keys: |
26-
${{ runner.os }}-yarn-
34+
path: ${{ env.STORE_PATH }}
35+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('web/**/pnpm-lock.yaml') }}
36+
restore-keys: |
37+
${{ runner.os }}-pnpm-store-
2738
28-
- name: Install Dependencies
29-
run: yarn
39+
- name: Install dependencies
40+
run: pnpm install --frozen-lockfile --strict-peer-dependencies
41+
working-directory: web
3042
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3244

33-
- run: yarn run lint:ci
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Lint
46+
run: pnpm run lint:ci

.npmrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
@pssbletrngle:registry=https://npm.pkg.github.com
2-
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
2+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
3+
4+
shamefully-hoist=true

Dockerfile

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
FROM node:16 as builder
1+
FROM node:18-alpine AS base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
5+
ENV CI=true
6+
7+
FROM base AS builder
28

39
WORKDIR /app
410

@@ -7,27 +13,11 @@ COPY . .
713
ARG github_token
814
ENV GITHUB_TOKEN=$github_token
915

10-
# Required packages for headless-gl to work, which is used to render the icon assets
11-
# RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64
12-
# RUN chmod +x /usr/local/bin/dumb-init
13-
RUN apt-get update && apt-get install -y --no-install-recommends -y \
14-
mesa-utils \
15-
xvfb \
16-
xauth \
17-
libgl1-mesa-dri \
18-
libglapi-mesa \
19-
libosmesa6
20-
21-
RUN yarn install \
22-
--prefer-offline \
23-
--frozen-lockfile \
24-
--non-interactive \
25-
--production=false
26-
27-
RUN xvfb-run yarn icongen
28-
RUN yarn build
29-
30-
FROM node:18
16+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
17+
18+
RUN pnpm run build
19+
20+
FROM base AS runner
3121

3222
WORKDIR /app
3323

components/Nav.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</NuxtLink>
77
<section class="flex gap-4 ml-auto">
88
<ThemeButton />
9-
<ProfileIcon v-if="loggedIn" />
9+
<ProfileIcon v-if="account" :account="account" />
1010
<NuxtLink v-else to="/login" class="px-2"> Login </NuxtLink>
1111
</section>
1212
</nav>
@@ -26,7 +26,7 @@ const links = ref([
2626
2727
const active = computed(() => [...links.value].reverse().find(it => route.path.startsWith(it.to))?.to)
2828
29-
const { loggedIn } = useSession()
29+
const { account } = useSession()
3030
</script>
3131

3232
<style lang="scss" scoped>

components/ProfileIcon.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<template>
22
<NuxtLink to="/me" class="w-12 h-12 justify-self-end">
3-
<img v-if="result?.me" alt="your avatar" :src="result.me.avatar!!" class="rounded-full" />
3+
<img v-if="account" alt="your avatar" :src="account.avatar!!" class="rounded-full" />
44
</NuxtLink>
55
</template>
66

77
<script lang="ts" setup>
8-
import { MeDocument } from '~/graphql/generated'
8+
import { SelfFragment } from "~/graphql/generated";
99
10-
const { result } = useQuery(MeDocument)
11-
</script>
10+
defineProps<{
11+
account: SelfFragment
12+
}>()
13+
</script>

components/map/Leaflet.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
zoom-animation
66
fade-animation
77
:crs="crs"
8-
:min-zoom="context?.minZoom"
9-
:max-zoom="context?.maxZoom"
8+
:min-zoom="context?.minZoom!"
9+
:max-zoom="context?.maxZoom!"
1010
:max-native-zoom="context?.maxNativeZoom"
11-
@contextmenu="emitWithPos('contextmenu', $event)"
12-
@click="emitWithPos('click', $event)"
11+
@ready="ready"
1312
>
1413
<MapTiles />
1514
<MapLocations />
@@ -18,14 +17,19 @@
1817

1918
<script lang="ts" setup>
2019
import { LMap } from '@vue-leaflet/vue-leaflet'
21-
import { CRS, LeafletMouseEvent } from 'leaflet'
20+
import { CRS, LeafletMouseEvent, Map } from 'leaflet'
2221
import { PosFragment } from '~/graphql/generated'
2322
2423
const emit = defineEmits<{
2524
(e: 'click', pos: PosFragment, event: LeafletMouseEvent): void
2625
(e: 'contextmenu', pos: PosFragment, event: LeafletMouseEvent): void
2726
}>()
2827
28+
function ready(map: Map) {
29+
map.on('contextmenu', e => emitWithPos('contextmenu', e))
30+
map.on('click', e => emitWithPos('click', e))
31+
}
32+
2933
function emitWithPos(e: 'click' | 'contextmenu', event: LeafletMouseEvent | PointerEvent) {
3034
if ('latlng' in event) {
3135
emit(e as any, toWorldPos(context.value!.map, event.latlng), event)
@@ -51,4 +55,4 @@ const background = computed(() => {
5155
img.leaflet-tile {
5256
image-rendering: pixelated;
5357
}
54-
</style>
58+
</style>

components/map/View.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ interface DynmapOptions {
2020
}
2121
2222
const { data: options, refresh } = await useFetch<DynmapOptions>('/dynmap/up/configuration', {
23-
transform: r => {
24-
console.log(r)
25-
return JSON.parse(r as unknown as string)
26-
},
23+
transform: r => JSON.parse(r as unknown as string),
2724
})
2825
2926
const context = useMap()

components/paginated/Filter.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<template>
2-
<FormKit :id="filterId" :classes="{ form: 'grid grid-flow-col gap-2 w-max mx-auto items-end' }" type="form"
3-
:actions="false" :value="rawValue" @input="update">
2+
<FormKit
3+
:id="filterId"
4+
:classes="{ form: 'grid grid-flow-col gap-2 w-max mx-auto items-end' }"
5+
type="form"
6+
:actions="false"
7+
:value="rawValue"
8+
@input="update"
9+
>
410
<span class="bg-solid-900 p-3 rounded mb-2 border-2 border-transparent"> Filter by </span>
511
<slot />
6-
<FormKit type="button" suffix-icon="trash" @click="reset(filterId)"> Reset </FormKit>
12+
<FormKit type="button" suffix-icon="trash" @click="reset(filterId)"> Reset</FormKit>
713
</FormKit>
814
</template>
915

composables/deferred.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Ref } from 'vue'
2+
3+
export default function useDeferred<T>(changing: Ref<T>) {
4+
const deferred = ref(changing.value) as Ref<T>
5+
watch(changing, it => {
6+
if (notNull(it)) deferred.value = it
7+
})
8+
return deferred
9+
}

composables/pagination.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { TypedDocumentNode } from '@graphql-typed-document-node/core'
22
import type { OperationDefinitionNode } from 'graphql'
33
import type { Ref } from 'vue'
44
import { Exact, PageInfo, Pagination } from '~/graphql/generated'
5+
import useDeferred from '~/composables/deferred'
56

67
export interface Connection<T> {
78
nodes: T[]
@@ -60,5 +61,7 @@ export function usePagination<T, Q extends ConnectionQuery<T>, F>(
6061
}
6162
}
6263

63-
return { next, previous, result, error }
64+
const deferredResult = useDeferred(result)
65+
66+
return { next, previous, result: deferredResult, error }
6467
}

0 commit comments

Comments
 (0)