Filter empty continents directly in GraphQL query
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<meta name="theme-color" content="#3C0576">
|
<meta name="theme-color" content="#3C0576">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
<link rel="icon" type="image/png" sizes="64x64" href="/images/favicon.png">
|
<link rel="icon" type="image/png" sizes="64x64" href="/images/favicon.png">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/images/siteicon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="/images/siteicon.png">
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
%sveltekit.body%
|
%sveltekit.body%
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.body.style.opacity = '0'
|
document.body.style.opacity = '0'
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
$: globeResolution = innerWidth > 1440 && window.devicePixelRatio > 1 ? '4k' : '2k'
|
$: globeResolution = innerWidth > 1440 && window.devicePixelRatio > 1 ? '4k' : '2k'
|
||||||
|
|
||||||
const { continents, locations } = getContext('global')
|
const { continents, locations } = getContext('global')
|
||||||
const randomContinent: any = getRandomItem(continents.filter((cont: any) => cont.countries))
|
const randomContinent: any = getRandomItem(continents)
|
||||||
const markers = locations.map(({ name, slug, country, coordinates: { coordinates }}): Marker => ({
|
const markers = locations.map(({ name, slug, country, coordinates: { coordinates }}): Marker => ({
|
||||||
name,
|
name,
|
||||||
slug,
|
slug,
|
||||||
|
|||||||
@@ -114,11 +114,10 @@
|
|||||||
locations { id slug }
|
locations { id slug }
|
||||||
}
|
}
|
||||||
|
|
||||||
continents: continent {
|
continents: continent (filter: { countries: { slug: { _neq: "_empty" }}}) {
|
||||||
name
|
name
|
||||||
slug
|
slug
|
||||||
rotation
|
rotation
|
||||||
countries { id slug }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settings {
|
settings {
|
||||||
@@ -163,14 +162,10 @@
|
|||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
const { data } = res
|
const { data } = res
|
||||||
const filteredContinents = data.continents.filter((cont: any) => cont.countries.length)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data,
|
||||||
...data,
|
|
||||||
continents: filteredContinents,
|
|
||||||
},
|
|
||||||
count: {
|
count: {
|
||||||
photos: data.countPhotos[0].count.id,
|
photos: data.countPhotos[0].count.id,
|
||||||
locations: data.countLocations[0].count.id,
|
locations: data.countLocations[0].count.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user