Skip to content

Commit

Permalink
1.0.0-rc.1 (#616)
Browse files Browse the repository at this point in the history
* 1.0.0-rc.1

* fix: lint
  • Loading branch information
daniluk4000 authored Jan 8, 2025
1 parent ff8b1d6 commit 059f563
Show file tree
Hide file tree
Showing 30 changed files with 651 additions and 90 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

# [1.0.0-rc.1]

- Added Bookmarks functionality
- Added update popup

# [1.0.0-beta.6]

- You can now save, export and share filters presets
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vatsim-radar",
"version": "1.0.0-beta.6",
"version": "1.0.0-rc.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
Binary file removed src/assets/update/aircraft.png
Binary file not shown.
Binary file added src/assets/update/bookmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/update/client.jpg
Binary file not shown.
Binary file removed src/assets/update/events.jpg
Binary file not shown.
Binary file added src/assets/update/filters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/update/friends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/update/layouts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/update/presentation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/update/search.png
Binary file not shown.
Binary file removed src/assets/update/settings.png
Binary file not shown.
Binary file added src/assets/update/vatglasses.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
225 changes: 225 additions & 0 deletions src/components/common/vatsim/CommonBookmarkData.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<template>
<div class="bookmark-data __info-sections">
<map-filter-columns v-if="!id && (!airport || getAirport)">
<template
v-if="!airport"
#col1
>
<div class="bookmark-data_airport __info-sections">
<common-toggle v-model="airportMode">
Bookmark Airport {{ bookmark.icao }}
</common-toggle>
<common-input-text
v-if="airportMode"
height="36px"
:model-value="airportInput"
@change="dataStore.vatspy.value?.data.keyAirports.realIcao[($event.target as HTMLInputElement).value.toUpperCase()] ? airportInput = ($event.target as HTMLInputElement).value.toUpperCase() : airportInput = ''"
>
Airport ICAO
</common-input-text>
</div>
</template>
<template
v-if="getAirport"
#col2
>
<div class="__grid-info-sections __grid-info-sections--large-title">
<div class="__grid-info-sections_title">
Zoom Level
</div>
<common-select
:items="zoomOptions"
max-dropdown-height="200px"
:model-value="bookmark.zoom ?? 14"
width="100%"
@update:modelValue="bookmark.zoom = $event as number"
/>
</div>
</template>
</map-filter-columns>
<small v-else-if="id && getAirport">
Airport: {{ getAirport }}
</small>
<div class="bookmark-data_keys __info-sections">
<common-block-title remove-margin>
Key Binding (optional)
</common-block-title>
<common-notification
cookie-name="bookmarks-keys"
type="info"
>
Supported combinations: Shift/Alt/Ctrl/Win/CMD plus any <strong>keyboard</strong> button
</common-notification>

<div
v-if="bookmark.binding"
class="bookmark-data_keys_data"
>
<span v-if="bookmark.binding?.keys?.ctrl">
CTRL
</span>
<span v-if="bookmark.binding?.keys?.alt">
ALT
</span>
<span v-if="bookmark.binding?.keys?.shift">
SHIFT
</span>
<span v-if="bookmark.binding?.keys?.meta">
WIN
</span>
<span>
{{ bookmark.binding?.code.replace('Key', '').replace('Digit', '') }}
</span>
<common-button
link-color="error500"
type="link"
@click="delete bookmark.binding"
>
Clear
</common-button>
</div>

<div class="bookmark-data_keys_data_input">
<common-input-text
ref="input"
:input-attrs="{ readonly: 'readonly' }"
model-value=""
placeholder="Press and type to bind..."
/>
</div>
</div>
</div>
</template>

<script setup lang="ts">
import type { UserBookmark, UserBookmarkPreset } from '~/utils/backend/handlers/bookmarks';
import CommonToggle from '~/components/common/basic/CommonToggle.vue';
import MapFilterColumns from '~/components/map/filters/filters/MapFilterColumns.vue';
import CommonInputText from '~/components/common/basic/CommonInputText.vue';
import type { SelectItem } from '~/types/components/select';
import CommonSelect from '~/components/common/basic/CommonSelect.vue';
import CommonNotification from '~/components/common/basic/CommonNotification.vue';
import CommonBlockTitle from '~/components/common/blocks/CommonBlockTitle.vue';
import CommonButton from '~/components/common/basic/CommonButton.vue';
import { useMapStore } from '~/store/map';
import type { ShallowRef } from 'vue';
import type { Map } from 'ol';
import { useStore } from '~/store';
const props = defineProps({
bookmark: {
type: Object as PropType<UserBookmark>,
required: true,
},
airport: {
type: String,
},
id: {
type: Number,
},
});
const dataStore = useDataStore();
const mapStore = useMapStore();
const store = useStore();
const map = inject<ShallowRef<Map | null>>('map')!;
const airportMode = ref(false);
const airportInput = ref('');
const input = useTemplateRef('input');
const getAirport = computed(() => props.airport || airportInput.value || props.bookmark.icao);
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
if (props.airport) props.bookmark.icao = props.airport;
const zoomOptions = (() => {
const options: SelectItem[] = [];
for (let i = 17; i >= 12; i -= 0.5) {
options.unshift({
value: i,
});
}
return options;
})();
watch(airportInput, val => {
if (!val) {
delete props.bookmark.icao;
return;
}
props.bookmark.icao = val;
});
watch(() => JSON.stringify(mapStore.extent), () => {
const view = map.value?.getView();
if (!view || props.id) return;
if (!getAirport.value) {
props.bookmark.coords = view.getCenter();
props.bookmark.zoom = view.getZoom();
}
else if (!props.bookmark.zoom) props.bookmark.zoom = 14;
}, {
immediate: true,
});
watch(() => JSON.stringify(props.bookmark), async () => {
if (!props.id) return;
airportInput.value = '';
await $fetch<UserBookmarkPreset>(`/api/user/bookmarks/${ props.id }`, {
method: 'PUT',
body: {
json: toRaw(props.bookmark),
},
});
store.fetchBookmarks();
});
onMounted(() => {
function handleKeys(event: KeyboardEvent) {
if (!event.ctrlKey && !event.altKey && !event.shiftKey && !event.metaKey) return;
if (event.key === 'Shift' || event.key === 'Alt' || event.key === 'Control' || event.key === 'Meta') return;
event.preventDefault();
props.bookmark.binding = {
code: event.code,
keys: {
meta: event.metaKey,
alt: event.altKey,
shift: event.shiftKey,
ctrl: event.ctrlKey,
},
};
}
input.value!.$el.querySelector('input')!.addEventListener('keydown', handleKeys);
});
</script>

<style scoped lang="scss">
.bookmark-data {
&_keys {
&_data {
display: flex;
gap: 4px;
align-items: center;
span {
padding: 4px;
border-radius: 4px;
font-family: $openSansFont;
font-size: 12px;
font-weight: 600;
line-height: 100%;
background: #26262C;
}
}
}
}
</style>
4 changes: 2 additions & 2 deletions src/components/map/MapMobileWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Favorite
</template>
<template #content>
<view-user-list :users="store.friends"/>
<view-favorite/>
</template>
</common-info-popup>
<map-popup
Expand Down Expand Up @@ -105,7 +105,7 @@ import CommonInfoPopup from '~/components/common/popup/CommonInfoPopup.vue';
import { useStore } from '~/store';
import CommonButton from '~/components/common/basic/CommonButton.vue';
import CloseIcon from 'assets/icons/basic/close.svg?component';
import ViewUserList from '~/components/views/ViewUserList.vue';
import ViewFavorite from '~/components/views/ViewFavorite.vue';
const store = useStore();
const mapStore = useMapStore();
Expand Down
34 changes: 30 additions & 4 deletions src/components/map/filters/MapFiltersPresets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
class="__info-sections"
>
<div
v-if="!currentPreset && Object.keys(selectedPreset).length"
v-if="noConfirm || (!currentPreset && Object.keys(selectedPreset).length)"
class="presets__create __info-sections"
>
<common-block-title remove-margin>
Save Current Settings
<slot name="title">
Save Current Settings
</slot>
</common-block-title>

<div class="presets__row presets__row--no-wrap">
Expand All @@ -22,7 +24,7 @@
/>
<div class="presets__row_divider"/>
<common-button
:disabled="presets.length >= maxPresets || !newPresetName"
:disabled="presets.length >= maxPresets || !newPresetName || presets.some(x => x.name.toLowerCase() === newPresetName.toLowerCase())"
size="S"
type="secondary"
@click="createPreset"
Expand All @@ -32,6 +34,11 @@
</template>
</common-button>
</div>

<slot
name="data"
:preset="selectedPreset"
/>
</div>

<small
Expand All @@ -58,7 +65,7 @@
<common-toggle
:model-value="currentPreset === preset.id"
@click.stop
@update:modelValue="$event ? [states.load = true, activePreset = preset] : emit('reset')"
@update:modelValue="$event ? noConfirm ? emit('save', preset.json) : [states.load = true, activePreset = preset] : emit('reset')"
/>
</template>
</common-block-title>
Expand All @@ -78,6 +85,7 @@
/>
<div class="presets__row_divider"/>
<common-tooltip
v-if="!disableActions"
location="bottom"
open-method="mouseOver"
>
Expand Down Expand Up @@ -116,6 +124,7 @@
Share
</common-tooltip>
<common-tooltip
v-if="!disableActions"
location="left"
open-method="mouseOver"
>
Expand All @@ -137,6 +146,12 @@
</div>
</div>

<slot
:id="preset.id"
name="data"
:preset="preset.json"
/>

<div class="presets__delete">
<common-button
focus-color="error700"
Expand Down Expand Up @@ -274,6 +289,14 @@ const props = defineProps({
type: Boolean,
default: false,
},
disableActions: {
type: Boolean,
default: false,
},
noConfirm: {
type: Boolean,
default: false,
},
});
const emit = defineEmits({
create(name: string, data: UserCustomPreset['json']) {
Expand All @@ -286,6 +309,9 @@ const emit = defineEmits({
return true;
},
});
defineSlots<{ title: () => any; data: (settings: { preset: UserCustomPreset['json']; id?: number }) => any }>();
const config = useRuntimeConfig();
export type UserCustomPreset = Omit<UserPreset, 'json'> & { [key: string]: any };
Expand Down
Loading

0 comments on commit 059f563

Please sign in to comment.