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

finished iteration of search #31

Merged
merged 5 commits into from
Jan 17, 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
4 changes: 2 additions & 2 deletions src/lib/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export const registerUsername = writable('');

//https://server-beta.de/api
//https://alpha.c930.net/api
//http://localhost:3000
//http://localhost:3000/api
// local network http://192.168.0.126:3000/api
export const serverURL = writable('https://server-beta.de/api');
export const serverURL = writable('http://localhost:3000/api');

export const token = persisted('token', '');
export const refreshToken = persisted('refreshToken', '');
38 changes: 38 additions & 0 deletions src/routes/search/posts/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script lang="ts">
import { Toast } from '@skeletonlabs/skeleton';
//import { getToastStore } from '@skeletonlabs/skeleton';
//import { createToast } from '$lib/Toasts';
import { initializeStores } from '@skeletonlabs/skeleton';
import Icon from '@iconify/svelte';
//import { serverURL } from '$lib/Store';
//import type { PostStructure } from '$lib/types/Post';

initializeStores();
//const toastStore = getToastStore();

//let response: Response;
//let hashtagInput: string;
//let serverUrl: string;
//let statusCode: number = 0;
//let posts: Array<PostStructure> = [];

//async function handleHashtagInput(event: Event) {}
</script>

<Toast />
<div class="mt-8 mb-8 w-3/5 min-h-screen mx-auto">
<div class="mb-8 flex justify-center items-center gap-4">
<a href="/search/users">
<Icon class="w-10 h-10" icon="mdi:account-search-outline" style="font-size: 32px" />
</a>
<a href="/search/posts">
<Icon
class="w-10 h-10"
icon="mdi:text-box-search"
style="font-size: 32px; border: 2px solid; border-radius: 5px;"
/>
</a>
</div>
<input class="input w-full" type="search" name="hashtag" placeholder="Search a hashtag..." />
<div class="mt-4 w-full"></div>
</div>
23 changes: 21 additions & 2 deletions src/routes/search/users/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Icon from '@iconify/svelte';
import { serverURL } from '$lib/Store';
import type { Profil } from '$lib/types/User';
import { Avatar } from '@skeletonlabs/skeleton';

initializeStores();
const toastStore = getToastStore();
Expand Down Expand Up @@ -80,6 +81,18 @@

<Toast />
<div class="mt-8 mb-8 w-3/5 min-h-screen mx-auto">
<div class="mb-8 flex justify-center items-center gap-4">
<a href="/search/users">
<Icon
class="w-10 h-10"
icon="mdi:account-search"
style="font-size: 32px; border: 2px solid; border-radius: 5px;"
/>
</a>
<a href="/search/posts">
<Icon class="w-10 h-10" icon="mdi:text-box-search-outline" style="font-size: 32px" />
</a>
</div>
<input
class="input w-full"
type="search"
Expand All @@ -91,9 +104,15 @@
{#each users as user}
<div class="flex flex-row items-center justify-between w-full">
<div class="flex flex-row items-center">
<img class="w-12 h-12 rounded-full" src={user.profilePictureUrl} alt="Avatar" />
<Avatar
src={user.profilePictureUrl !== '' ? user.profilePictureUrl : '/default-avatar.png'}
width="w-12"
rounded="rounded-full"
/>
<div class="ml-4">
<a href="/users/{user.username}" class="text-lg font-semibold">{user.nickname}</a>
<a href="/profile?username={user.username}" class="text-lg font-semibold"
>{user.nickname}</a
>
<p class="text-gray-500">@{user.username}</p>
</div>
</div>
Expand Down