Compare commits
7
Commits
1.3
...
1ef4ae4a21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ef4ae4a21 | ||
|
|
90ea8d81d2 | ||
|
|
8514d76724 | ||
|
|
7bca9a8d31 | ||
|
|
e17203aefc | ||
|
|
02521da9c3 | ||
|
|
ed0ce97548 |
@@ -3,19 +3,35 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Attributes\Argument;
|
||||||
use Illuminate\Console\Attributes\Description;
|
use Illuminate\Console\Attributes\Description;
|
||||||
use Illuminate\Console\Attributes\Signature;
|
use Illuminate\Console\Attributes\Signature;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
#[Signature('app:recalculate-achivements')]
|
#[Signature('app:recalculate-achievements {username? : The username of a single user to recalculate}')]
|
||||||
#[Description('Recalculate achievements for all users')]
|
#[Description('Recalculate achievements for all users, or a single user by username')]
|
||||||
class RecalculateAchievements extends Command
|
class RecalculateAchievements extends Command
|
||||||
{
|
{
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$users = User::all();
|
$username = $this->argument('username');
|
||||||
foreach ($users as $user) {
|
|
||||||
$user->calculateAchievements();
|
if ($username) {
|
||||||
|
$user = User::where('name', $username)->first();
|
||||||
|
|
||||||
|
if (! $user) {
|
||||||
|
$this->error("No user found with username [{$username}].");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user->calculateAchievements();
|
||||||
|
$this->info("Recalculated achievements for {$username}.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = User::all();
|
||||||
|
$this->withProgressBar($users, fn (User $user) => $user->calculateAchievements());
|
||||||
|
$this->newLine();
|
||||||
|
$this->info("Recalculated achievements for {$users->count()} users.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class AchievementService
|
|||||||
* @var Collection<int,UserFlight> $flights
|
* @var Collection<int,UserFlight> $flights
|
||||||
*/
|
*/
|
||||||
private Collection $flights;
|
private Collection $flights;
|
||||||
|
private int $loggedFlightCount;
|
||||||
|
|
||||||
public function calculate(User $user): void
|
public function calculate(User $user): void
|
||||||
{
|
{
|
||||||
@@ -64,20 +65,24 @@ class AchievementService
|
|||||||
'arrivalAirport.region.continent',
|
'arrivalAirport.region.continent',
|
||||||
])->where('departure_date', '<=', now('UTC'))->get();
|
])->where('departure_date', '<=', now('UTC'))->get();
|
||||||
|
|
||||||
|
$this->loggedFlightCount = $user->flights()->count();
|
||||||
|
|
||||||
foreach ($this->checkers as $checkerClass) {
|
foreach ($this->checkers as $checkerClass) {
|
||||||
$checker = new $checkerClass($this);
|
$checker = new $checkerClass($this);
|
||||||
$checker->check($user);
|
$checker->check($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int,UserFlight>
|
|
||||||
*/
|
|
||||||
public function getFlights(): Collection
|
public function getFlights(): Collection
|
||||||
{
|
{
|
||||||
return $this->flights;
|
return $this->flights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLoggedFlightCount(): int
|
||||||
|
{
|
||||||
|
return $this->loggedFlightCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Award / revoke
|
// Award / revoke
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ abstract class BaseChecker implements AchievementCheckerInterface
|
|||||||
return $this->service->getFlights();
|
return $this->service->getFlights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function allLoggedFlightsCount(): int
|
||||||
|
{
|
||||||
|
return $this->service->getLoggedFlightCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve an achievement ID from its internal name.
|
* Resolve an achievement ID from its internal name.
|
||||||
* Results are cached on the service so repeated lookups are free.
|
* Results are cached on the service so repeated lookups are free.
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ class GeneralFlyingChecker extends BaseChecker
|
|||||||
*/
|
*/
|
||||||
$flights = $this->flights();
|
$flights = $this->flights();
|
||||||
$count = $flights->count();
|
$count = $flights->count();
|
||||||
|
$allLoggedFlightsCount = $this->allLoggedFlightsCount();
|
||||||
|
|
||||||
// --- Boolean achievements ---
|
// --- Boolean achievements ---
|
||||||
|
|
||||||
$this->awardIf($count >= 1, 'general_flying.first_flight');
|
$this->awardIf($allLoggedFlightsCount >= 1, 'general_flying.first_flight');
|
||||||
|
|
||||||
$this->awardIf(
|
$this->awardIf(
|
||||||
$flights->contains(fn ($f) => $f->isDomestic()),
|
$flights->contains(fn ($f) => $f->isDomestic()),
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<template>
|
||||||
|
<v-btn
|
||||||
|
:color="copied ? 'success' : color"
|
||||||
|
:variant="variant"
|
||||||
|
:icon="iconOnly"
|
||||||
|
:size="iconOnly ? 'x-small' : 'default'"
|
||||||
|
@click="handleCopy"
|
||||||
|
>
|
||||||
|
<v-icon :start="!iconOnly" :icon="copied ? 'mdi-check' : 'mdi-content-copy'" />
|
||||||
|
<template v-if="!iconOnly">{{ copied ? 'Copied Link To Page!' : label }}</template>
|
||||||
|
<v-tooltip v-if="iconOnly" activator="parent" location="top">
|
||||||
|
{{ copied ? 'Copied Link To Page!' : label }}
|
||||||
|
</v-tooltip>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useDisplay } from 'vuetify';
|
||||||
|
import { copyToClipboard } from '@/Composables/useClipboard';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
label?: string;
|
||||||
|
color?: string;
|
||||||
|
variant?: 'flat' | 'text' | 'elevated' | 'tonal' | 'outlined' | 'plain';
|
||||||
|
resetDelay?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
label: 'Copy link',
|
||||||
|
color: 'primary',
|
||||||
|
variant: 'outlined',
|
||||||
|
resetDelay: 2000,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { mobile } = useDisplay();
|
||||||
|
const iconOnly = mobile;
|
||||||
|
|
||||||
|
const copied = ref(false);
|
||||||
|
let resetTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|
||||||
|
async function handleCopy() {
|
||||||
|
try {
|
||||||
|
await copyToClipboard(window.location.href);
|
||||||
|
copied.value = true;
|
||||||
|
|
||||||
|
if (resetTimeout) clearTimeout(resetTimeout);
|
||||||
|
resetTimeout = setTimeout(() => {
|
||||||
|
copied.value = false;
|
||||||
|
}, props.resetDelay);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to copy URL:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -270,20 +270,6 @@ onMounted(async () => {
|
|||||||
emitFilters()
|
emitFilters()
|
||||||
})
|
})
|
||||||
|
|
||||||
// ── Copy link ─────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
const linkCopied = ref(false)
|
|
||||||
|
|
||||||
async function copyFilterLink() {
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(window.location.href)
|
|
||||||
linkCopied.value = true
|
|
||||||
setTimeout(() => { linkCopied.value = false }, 2000)
|
|
||||||
} catch {
|
|
||||||
// Clipboard API unavailable (e.g. non-secure context) - nothing to fall
|
|
||||||
// back to here, the button just silently no-ops.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Helpers ───────────────────────────────────────────────────────────────────
|
// ── Helpers ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -670,18 +656,6 @@ const countryFlagClass = (code: string) =>
|
|||||||
</v-select>
|
</v-select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flight-filters-actions">
|
|
||||||
<v-btn
|
|
||||||
:prepend-icon="linkCopied ? 'mdi-check' : 'mdi-link-variant'"
|
|
||||||
:color="linkCopied ? 'success' : undefined"
|
|
||||||
variant="outlined"
|
|
||||||
size="small"
|
|
||||||
@click="copyFilterLink"
|
|
||||||
>
|
|
||||||
{{ linkCopied ? 'Copied!' : 'Copy Link to This Page With Filters' }}
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="flight-map-wrapper">
|
<div class="flight-map-wrapper" :class="{ tooltip }">
|
||||||
<PlaneLoader v-if="!mapReady" class="map-loader" />
|
<PlaneLoader v-if="!mapReady" class="map-loader" />
|
||||||
<div ref="mapContainer" class="map-container" :class="{ 'map-hidden': !mapReady }" />
|
<div ref="mapContainer" class="map-container" :class="{ 'map-hidden': !mapReady }" />
|
||||||
<button @click="exportMapBasic()" class="export-btn" title="Download as Image">
|
<button @click="exportMapBasic()" class="export-btn" title="Download as Image">
|
||||||
@@ -277,8 +277,11 @@ export default defineComponent({
|
|||||||
compact: {
|
compact: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props) {
|
setup(props) {
|
||||||
@@ -821,6 +824,11 @@ export default defineComponent({
|
|||||||
aspect-ratio: 7 / 10;
|
aspect-ratio: 7 / 10;
|
||||||
max-height: none;
|
max-height: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flight-map-wrapper.tooltip {
|
||||||
|
aspect-ratio: 16 / 10;
|
||||||
|
max-height: 30vh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
small.attribution{
|
small.attribution{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ defineProps<{
|
|||||||
|
|
||||||
|
|
||||||
<ToolTipRows v-if="isActive.value">
|
<ToolTipRows v-if="isActive.value">
|
||||||
<FlightMap :flights="[flight]" :showLegend="false" compact />
|
<FlightMap :flights="[flight]" :showLegend="false" compact tooltip />
|
||||||
</ToolTipRows>
|
</ToolTipRows>
|
||||||
|
|
||||||
<ToolTipDivider />
|
<ToolTipDivider />
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ defineProps<{
|
|||||||
rowKey: (row: T) => string | number
|
rowKey: (row: T) => string | number
|
||||||
hasItems: (row: T) => boolean
|
hasItems: (row: T) => boolean
|
||||||
labelWidth?: string
|
labelWidth?: string
|
||||||
|
compactOnMobile?: boolean
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -15,7 +16,11 @@ defineProps<{
|
|||||||
class="badge-row"
|
class="badge-row"
|
||||||
>
|
>
|
||||||
<!-- Label column: consumer provides content -->
|
<!-- Label column: consumer provides content -->
|
||||||
<div class="badge-label" :style="labelWidth ? `width: ${labelWidth}` : ''">
|
<div
|
||||||
|
class="badge-label"
|
||||||
|
:class="{ 'badge-label--compact': compactOnMobile }"
|
||||||
|
:style="labelWidth ? `width: ${labelWidth}` : ''"
|
||||||
|
>
|
||||||
<slot name="label" :row="row" />
|
<slot name="label" :row="row" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -38,8 +43,6 @@ defineProps<{
|
|||||||
container-type: inline-size;
|
container-type: inline-size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.badge-row {
|
.badge-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -49,13 +52,13 @@ defineProps<{
|
|||||||
|
|
||||||
.badge-label {
|
.badge-label {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: 15em;
|
width: 21em;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
border-right: 1px solid var(--table-border);
|
border-right: 1px solid var(--table-border);
|
||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size:0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@container (max-width: 480px) {
|
@container (max-width: 480px) {
|
||||||
@@ -63,6 +66,12 @@ defineProps<{
|
|||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
width: 9em;
|
width: 9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badge-label--compact {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
width: clamp(6em, 50cqw, 9em);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-scroll-container {
|
.badge-scroll-container {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Link, usePage } from "@inertiajs/vue3"
|
import { Link, usePage } from "@inertiajs/vue3"
|
||||||
import { SharedProps } from "@/Types/types"
|
import { SharedProps } from "@/Types/types"
|
||||||
|
import CopyPageButton from "@/Components/FlightsGoneBy/CopyPageButton.vue";
|
||||||
|
|
||||||
const page = usePage<SharedProps>().props
|
const page = usePage<SharedProps>().props
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
@@ -63,9 +64,17 @@ footer {
|
|||||||
color: #ffc107;
|
color: #ffc107;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer-version {
|
||||||
|
opacity: 0.8;
|
||||||
|
margin-left: 0.4em;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
footer {
|
footer {
|
||||||
padding: 0 1rem;
|
flex-wrap: wrap;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
row-gap: 0.5rem;
|
||||||
|
padding: 0.6rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-copyright {
|
.footer-copyright {
|
||||||
@@ -75,10 +84,6 @@ footer {
|
|||||||
.footer-link {
|
.footer-link {
|
||||||
font-size: 0.6rem;
|
font-size: 0.6rem;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.footer-version {
|
|
||||||
opacity: 0.8;
|
|
||||||
margin-left: 0.4em;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ onUnmounted(() => document.removeEventListener('click', handleClickOutside))
|
|||||||
<Logo variant="color" />
|
<Logo variant="color" />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<UserSearchBox class="user-search-box" density="compact" style="max-width:400px; width: 400px;" />
|
<UserSearchBox class="nav-desktop" density="compact" style="max-width:400px; width: 400px;" />
|
||||||
<NotificationMenu v-if="page.props.auth?.user" :unread-count="page.props.unread_notification_count" />
|
<NotificationMenu v-if="page.props.auth?.user" :unread-count="page.props.unread_notification_count" />
|
||||||
|
|
||||||
<!-- Desktop nav -->
|
<!-- Desktop nav -->
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ watch(search, (newQuery) => {
|
|||||||
no-filter
|
no-filter
|
||||||
clearable
|
clearable
|
||||||
hide-details
|
hide-details
|
||||||
|
hide-no-data
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
>
|
>
|
||||||
<template #item="{ item }">
|
<template #item="{ item }">
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { ref } from "vue";
|
|||||||
import NotificationListener from "@/Components/FlightsGoneBy/NotificationListener.vue";
|
import NotificationListener from "@/Components/FlightsGoneBy/NotificationListener.vue";
|
||||||
import {SharedProps} from "@/Types/types";
|
import {SharedProps} from "@/Types/types";
|
||||||
import PushNotificationPrompt from "@/Components/PushNotificationPrompt.vue";
|
import PushNotificationPrompt from "@/Components/PushNotificationPrompt.vue";
|
||||||
|
import CopyPageButton from "@/Components/FlightsGoneBy/CopyPageButton.vue";
|
||||||
const transitionKey = ref(0);
|
const transitionKey = ref(0);
|
||||||
|
|
||||||
const page = usePage<SharedProps>().props
|
const page = usePage<SharedProps>().props
|
||||||
@@ -27,6 +28,9 @@ router.on('success', () => {
|
|||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
<span class="footer-share">
|
||||||
|
<CopyPageButton label="Share Link" />
|
||||||
|
</span>
|
||||||
<MainFooter :key="`footer-${transitionKey}`" />
|
<MainFooter :key="`footer-${transitionKey}`" />
|
||||||
</div>
|
</div>
|
||||||
<NotificationListener v-if="page.auth.user?.id" :user-id="page.auth.user?.id" />
|
<NotificationListener v-if="page.auth.user?.id" :user-id="page.auth.user?.id" />
|
||||||
@@ -51,6 +55,14 @@ footer {
|
|||||||
min-height: 3rem;
|
min-height: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
footer {
|
||||||
|
flex: 0 1 auto;
|
||||||
|
min-height: 3.25rem;
|
||||||
|
padding-block: 0.35rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@@ -60,6 +72,12 @@ main {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer-share {
|
||||||
|
padding:1em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.fade-enter-from,
|
.fade-enter-from,
|
||||||
.fade-leave-to { opacity: 0; }
|
.fade-leave-to { opacity: 0; }
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
|
|||||||
+64
-2
@@ -21,6 +21,12 @@ const continents = computed(() => props.continents.filter(c => c.internal_name !
|
|||||||
|
|
||||||
const { entriesByDeparture, departureNames, completedCount, totalCount } =
|
const { entriesByDeparture, departureNames, completedCount, totalCount } =
|
||||||
useDirectedContinentPairs(flights, continents)
|
useDirectedContinentPairs(flights, continents)
|
||||||
|
|
||||||
|
// Split "Africa → Asia" into ["Africa", "Asia"] for independent flex items
|
||||||
|
function splitLabel(label: string): [string, string] {
|
||||||
|
const [from, to] = label.split('→').map(part => part.trim())
|
||||||
|
return [from, to]
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -35,11 +41,16 @@ const { entriesByDeparture, departureNames, completedCount, totalCount } =
|
|||||||
:rows="entriesByDeparture.get(dep) ?? []"
|
:rows="entriesByDeparture.get(dep) ?? []"
|
||||||
:rowKey="entry => entry.key"
|
:rowKey="entry => entry.key"
|
||||||
:hasItems="entry => entry.flights.length > 0"
|
:hasItems="entry => entry.flights.length > 0"
|
||||||
labelWidth="18em"
|
compactOnMobile
|
||||||
>
|
>
|
||||||
<template #label="{ row: entry }">
|
<template #label="{ row: entry }">
|
||||||
<div class="pair-label">
|
<div class="pair-label">
|
||||||
<span class="pair-name">{{ entry.label }}</span>
|
<span class="pair-part">{{ splitLabel(entry.label)[0] }}</span>
|
||||||
|
<span class="pair-divider">
|
||||||
|
<span class="divider-horizontal">{{ '\u2192\uFE0E' }}</span>
|
||||||
|
<span class="divider-vertical">{{ '\u2193\uFE0E' }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="pair-part">{{ splitLabel(entry.label)[1] }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -80,4 +91,55 @@ const { entriesByDeparture, departureNames, completedCount, totalCount } =
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-bottom: 0.75rem;
|
margin-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pair-label {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
padding: 0 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-part {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-divider {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-vertical {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 480px) {
|
||||||
|
.pair-label {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-part {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-divider {
|
||||||
|
font-size: 0.65rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-horizontal {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-vertical {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+54
-4
@@ -19,6 +19,12 @@ const flights = computed(() => props.flights)
|
|||||||
const continents = computed(() => props.continents.filter(c => c.internal_name !== 'antarctica'))
|
const continents = computed(() => props.continents.filter(c => c.internal_name !== 'antarctica'))
|
||||||
|
|
||||||
const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flights, continents)
|
const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flights, continents)
|
||||||
|
|
||||||
|
// Split "Africa↔Asia" into ["Africa", "Asia"] for independent flex items
|
||||||
|
function splitLabel(label: string): [string, string] {
|
||||||
|
const [from, to] = label.split('↔')
|
||||||
|
return [from, to]
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -32,11 +38,16 @@ const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flig
|
|||||||
:rows="entries"
|
:rows="entries"
|
||||||
:rowKey="entry => entry.key"
|
:rowKey="entry => entry.key"
|
||||||
:hasItems="entry => entry.flights.length > 0"
|
:hasItems="entry => entry.flights.length > 0"
|
||||||
labelWidth="18em"
|
compactOnMobile
|
||||||
>
|
>
|
||||||
<template #label="{ row: entry }">
|
<template #label="{ row: entry }">
|
||||||
<div class="pair-label">
|
<div class="pair-label">
|
||||||
<span class="pair-name">{{ entry.label }}</span>
|
<span class="pair-part">{{ splitLabel(entry.label)[0] }}</span>
|
||||||
|
<span class="pair-divider">
|
||||||
|
<span class="divider-horizontal">{{ '\u2194\uFE0E' }}</span>
|
||||||
|
<span class="divider-vertical">{{ '\u2195\uFE0E' }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="pair-part">{{ splitLabel(entry.label)[1] }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -80,12 +91,51 @@ const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flig
|
|||||||
.pair-label {
|
.pair-label {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5rem;
|
justify-content: center;
|
||||||
|
gap: 0.35rem;
|
||||||
padding: 0 0.25rem;
|
padding: 0 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pair-name {
|
.pair-part {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-divider {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-vertical {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 480px) {
|
||||||
|
.pair-label {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-part {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-divider {
|
||||||
|
font-size: 0.65rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-horizontal {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-vertical {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user