Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show projects only on desktop devices #643

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"isomorphic-dompurify": "^1.8.0",
"marked": "^11.1.1",
"svelte-codemirror-editor": "^1.1.0",
"svelte-device-info": "^1.0.0",
"svelte-highlight": "^7.4.6",
"svelte-multiselect": "^10.2.0",
"svelte-vega": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/home/HomeSearchBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</Fab>
{/if}
</div>
<div class="mt-4 flex h-full items-center md:ml-4 md:mt-0">
<div class="mt-4 hidden h-full items-center sm:flex md:ml-4 md:mt-0">
{#if loading}
<Spinner width={24} height={24} />
{/if}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
declare module '@svelte-plugins/tooltips';
declare module 'svelecte';
declare module 'simple-svelte-autocomplete';
declare module 'svelte-device-info';
2 changes: 1 addition & 1 deletion frontend/src/routes/(app)/home/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{/if}
</div>

<div class="ml-auto mr-10">
<div class="ml-auto mr-10 hidden sm:block">
<svg
width="300"
height="150"
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/routes/(app)/home/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<script lang="ts">
import { browser } from '$app/environment';
import HomeCard from '$lib/components/home/HomeCard.svelte';
import HomeSearchBar from '$lib/components/home/HomeSearchBar.svelte';
import { inViewport } from '$lib/util/viewport';

import {
EntrySort,
EntryTypeFilter,
type HomeEntry,
type ZenoService
} from '$lib/zenoapi/index.js';
import { getContext } from 'svelte';
import Device from 'svelte-device-info';

export let data;

Expand All @@ -21,6 +22,13 @@
let entries: HomeEntry[] = data.entries;
let loading = false;

if (browser) {
if (Device.isMobile) {
typeFilter = EntryTypeFilter.REPORT;
updateEntries(searchText, typeFilter, sort);
}
}

function updateEntries(searchString: string, typeFilter: EntryTypeFilter, sort: EntrySort) {
loading = true;
zenoClient
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/routes/(app)/home/[user]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script lang="ts">
import { browser } from '$app/environment';
import Banner from '$lib/components/general/Banner.svelte';
import HomeCard from '$lib/components/home/HomeCard.svelte';
import HomeSearchBar from '$lib/components/home/HomeSearchBar.svelte';
import { inViewport } from '$lib/util/viewport.js';
import { EntrySort, EntryTypeFilter, ZenoService, type HomeEntry } from '$lib/zenoapi/index.js';
import { getContext } from 'svelte';
import Device from 'svelte-device-info';

export let data;

Expand All @@ -16,6 +18,13 @@
let entries: HomeEntry[] = data.entries;
let loading = false;

if (browser) {
if (Device.isMobile) {
typeFilter = EntryTypeFilter.REPORT;
updateEntries(searchText, typeFilter, sort);
}
}

function updateEntries(searchString: string, typeFilter: EntryTypeFilter, sort: EntrySort) {
loading = true;
zenoClient
Expand Down
Loading