makes profiles public

This commit is contained in:
Christian Beutel
2024-11-16 15:13:22 +01:00
parent 2e8d7f5e82
commit dcc8da83e7
19 changed files with 364 additions and 41 deletions

View File

@@ -78,7 +78,7 @@
function handleDropdownClick(item: { text: string; value: any }) {
if (item.value == "profile") {
goto("/profile");
goto(`/profile/${$currentUser?.id}`);
} else if (item.value == "logout") {
logout();
window.location.href = "/";
@@ -128,7 +128,7 @@
<div class="basis-full"></div>
<hr class="border-input-border" />
<div class="flex gap-4 items-center justify-between m-4">
<a href="/profile">
<a href="/profile/{$currentUser.id}">
<img
class="rounded-full w-10 aspect-square"
src={getFileURL($currentUser, $currentUser.avatar) ||
@@ -136,7 +136,7 @@
alt="avatar"
/>
</a>
<a href="/profile">
<a href="/profile/{$currentUser.id}">
<p class="text-sm">{$currentUser.username}</p>
<p class="text-sm text-gray-500">
{$currentUser.email}

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import type { List } from "$lib/models/list";
import type { Trail } from "$lib/models/trail";
import type { User } from "$lib/models/user";
import type { User, UserAnonymous } from "$lib/models/user";
import { pb } from "$lib/pocketbase";
import { users_show } from "$lib/stores/user_store";
import { getFileURL } from "$lib/util/file_util";
@@ -18,7 +18,7 @@
let loading: boolean = false;
let infoLoaded: boolean = false;
let subjectIsOwned: boolean = subject.author == pb.authStore.model?.id;
let author: User;
let author: UserAnonymous;
async function fetchInfo() {
if (!infoLoaded) {

View File

@@ -14,6 +14,7 @@
export let summitLogs: SummitLog[] = [];
export let showCategory: boolean = false;
export let showTrail: boolean = false;
export let showAuthor: boolean = false;
let openMapModal: () => void;
let closeMapModal: () => void;
@@ -27,9 +28,7 @@
let currentText: string = "";
onMount(async () => {
});
onMount(async () => {});
async function openMap(log: SummitLog) {
if (!log.expand.gpx_data) {
@@ -72,6 +71,11 @@
</th>
{/if}
<th>{$_("description")}</th>
{#if showAuthor}
<th>
{$_("author", { values: { n: 1 } })}
</th>
{/if}
</tr>
</thead>
<tbody>
@@ -83,6 +87,7 @@
on:text={(e) => openText(e.detail)}
{showCategory}
{showTrail}
{showAuthor}
></SummitLogTableRow>
{/each}
</tbody>

View File

@@ -11,11 +11,13 @@
import type { Map } from "leaflet";
import { createEventDispatcher, onMount } from "svelte";
import { _ } from "svelte-i18n";
import { getFileURL } from "$lib/util/file_util";
export let index: number;
export let log: SummitLog;
export let showCategory: boolean = false;
export let showTrail: boolean = false;
export let showAuthor: boolean = false;
let map: Map;
@@ -64,13 +66,10 @@
}
function colCount() {
if (showCategory && showTrail) {
return 9;
} else if (showCategory || showTrail) {
return 8;
}
return 7;
return [showCategory, showTrail, showAuthor].reduce(
(b, v) => (v ? b + 1 : b),
7,
);
}
</script>
@@ -130,6 +129,26 @@
>
{/if}
</td>
{#if showAuthor && log.expand.author}
<td>
<p
class="tooltip flex justify-center"
data-title={log.expand.author.username}
>
<a href="/profile/{log.expand.author.id}">
<img
class="rounded-full w-7 aspect-square"
src={getFileURL(
log.expand?.author,
log.expand?.author.avatar,
) ||
`https://api.dicebear.com/7.x/initials/svg?seed=${log.expand?.author.username}&backgroundType=gradientLinear`}
alt="avatar"
/>
</a>
</p>
</td>
{/if}
</tr>
<tr>
<td colspan={colCount()}> <hr class="border-input-border" /> </td>

View File

@@ -172,7 +172,7 @@
class="trail-info-panel mx-auto {mode == 'list'
? ''
: 'border border-input-border rounded-3xl'} h-full"
style="max-width: min(100%, 64rem);"
style="max-width: min(100%, 76rem);"
>
<div class="trail-info-panel-header">
<section class="relative h-80">
@@ -239,7 +239,7 @@
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.username}&backgroundType=gradientLinear`}
alt="avatar"
/>
{trail.expand.author.username}
<a class="underline" href="/profile/{trail.expand.author.id}">{trail.expand.author.username}</a>
</p>
{/if}
<div class="flex flex-wrap gap-x-8 gap-y-2 mt-4 mr-8">
@@ -357,8 +357,8 @@
</div>
{/if}
{#if activeTab == 3}
<div class="overflow-x-scroll">
<SummitLogTable summitLogs={trail.expand.summit_logs}
<div class="overflow-x-auto">
<SummitLogTable summitLogs={trail.expand.summit_logs} showAuthor
></SummitLogTable>
</div>
{/if}