mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Add user page
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { createIcon } from "@app/lib/blockies";
|
||||
|
||||
export let nodeId: string;
|
||||
export let inline = false;
|
||||
export let variant: "small" | "large";
|
||||
|
||||
function createContainer(source: string) {
|
||||
source = source.replace("did:key:", "");
|
||||
@@ -19,20 +19,19 @@
|
||||
<style>
|
||||
.avatar {
|
||||
display: block;
|
||||
border-radius: var(--border-radius-round);
|
||||
box-shadow: 0 0 0 1px var(--color-border-match-background);
|
||||
min-width: 1rem;
|
||||
min-height: 1rem;
|
||||
height: 100%;
|
||||
width: inherit;
|
||||
object-fit: cover;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.inline {
|
||||
display: inline-block !important;
|
||||
.small {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border-radius: var(--border-radius-round);
|
||||
}
|
||||
.large {
|
||||
width: 4rem;
|
||||
border-radius: var(--border-radius-small);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -40,5 +39,6 @@
|
||||
title={nodeId}
|
||||
src={createContainer(nodeId)}
|
||||
class="avatar"
|
||||
alt="avatar"
|
||||
class:inline />
|
||||
class:small={variant === "small"}
|
||||
class:large={variant === "large"}
|
||||
alt="avatar" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Comment } from "@http-client";
|
||||
import type { BaseUrl, Comment } from "@http-client";
|
||||
|
||||
import * as utils from "@app/lib/utils";
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
export let id: string;
|
||||
export let authorId: string;
|
||||
export let authorAlias: string | undefined = undefined;
|
||||
export let baseUrl: BaseUrl;
|
||||
export let body: string;
|
||||
export let reactions: Comment["reactions"] | undefined = undefined;
|
||||
export let caption = "commented";
|
||||
@@ -107,7 +108,7 @@
|
||||
{/if}
|
||||
<div class="card-header" class:card-header-no-icon={isReply}>
|
||||
<slot class="icon" name="icon" />
|
||||
<NodeId nodeId={authorId} alias={authorAlias} />
|
||||
<NodeId {baseUrl} nodeId={authorId} alias={authorAlias} />
|
||||
<slot name="caption">{caption}</slot>
|
||||
<Id {id} />
|
||||
<span class="timestamp" title={utils.absoluteTimestamp(timestamp)}>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
export let shorten: boolean = true;
|
||||
export let style: "oid" | "commit" | "none" = "oid";
|
||||
export let ariaLabel: string | undefined = undefined;
|
||||
export let styleWidth: string | undefined = undefined;
|
||||
|
||||
let icon: ComponentProps<Icon>["name"] = "clipboard";
|
||||
const text = "Click to copy";
|
||||
@@ -72,7 +73,7 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div class="container" style:width={styleWidth}>
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
on:mouseenter={() => {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<script lang="ts">
|
||||
import type { BaseUrl } from "@http-client";
|
||||
import { formatNodeId, parseNodeId, truncateId } from "@app/lib/utils";
|
||||
|
||||
import Avatar from "./Avatar.svelte";
|
||||
import Id from "./Id.svelte";
|
||||
import Link from "./Link.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
export let nodeId: string;
|
||||
export let alias: string | undefined = undefined;
|
||||
</script>
|
||||
@@ -12,7 +14,6 @@
|
||||
.avatar-alias {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.375rem;
|
||||
height: 1rem;
|
||||
font-family: var(--font-family-monospace);
|
||||
@@ -24,9 +25,9 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Id id={nodeId} style="none">
|
||||
<div class="avatar-alias">
|
||||
<Avatar {nodeId} />
|
||||
<div class="avatar-alias">
|
||||
<Avatar variant="small" {nodeId} />
|
||||
<Link styleHoverState route={{ resource: "users", did: nodeId, baseUrl }}>
|
||||
{#if alias}
|
||||
<span class="txt-overflow">
|
||||
{alias}
|
||||
@@ -39,5 +40,5 @@
|
||||
{truncateId(parseNodeId(nodeId)?.pubkey || "")}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</Id>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
import Link from "@app/components/Link.svelte";
|
||||
|
||||
export let compact = false;
|
||||
|
||||
export let projectInfo: ProjectInfo;
|
||||
|
||||
$: project = projectInfo.project;
|
||||
@@ -155,6 +154,7 @@
|
||||
<Icon name="lock" />
|
||||
</div>
|
||||
{/if}
|
||||
<slot name="delegate" />
|
||||
<Badge
|
||||
variant="neutral"
|
||||
size="tiny"
|
||||
|
||||
@@ -18,9 +18,16 @@ export interface ProjectInfo {
|
||||
export async function fetchProjectInfos(
|
||||
baseUrl: BaseUrl,
|
||||
query?: ProjectListQuery,
|
||||
delegate?: string,
|
||||
): Promise<ProjectInfo[]> {
|
||||
const api = new HttpdClient(baseUrl);
|
||||
const projects = await api.project.getAll(query);
|
||||
let projects: Project[];
|
||||
|
||||
if (delegate) {
|
||||
projects = await api.project.getByDelegate(delegate, query);
|
||||
} else {
|
||||
projects = await api.project.getAll(query);
|
||||
}
|
||||
const info = await Promise.all(
|
||||
projects.map(async project => {
|
||||
const [activity, lastCommit] = await Promise.all([
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Comment } from "@http-client";
|
||||
import type { BaseUrl, Comment } from "@http-client";
|
||||
|
||||
import CommentComponent from "@app/components/Comment.svelte";
|
||||
import Icon from "./Icon.svelte";
|
||||
@@ -9,6 +9,7 @@
|
||||
replies: Comment[];
|
||||
};
|
||||
export let rawPath: string;
|
||||
export let baseUrl: BaseUrl;
|
||||
|
||||
$: root = thread.root;
|
||||
$: replies = thread.replies;
|
||||
@@ -43,6 +44,7 @@
|
||||
<div class="comments">
|
||||
<div class="top-level-comment" class:has-replies={replies.length > 0}>
|
||||
<CommentComponent
|
||||
{baseUrl}
|
||||
{rawPath}
|
||||
id={root.id}
|
||||
lastEdit={root.edits.length > 1 ? root.edits.pop() : undefined}
|
||||
@@ -58,6 +60,7 @@
|
||||
<div class="replies">
|
||||
{#each replies as reply}
|
||||
<CommentComponent
|
||||
{baseUrl}
|
||||
{rawPath}
|
||||
lastEdit={reply.edits.length > 1 ? reply.edits.pop() : undefined}
|
||||
id={reply.id}
|
||||
|
||||
Reference in New Issue
Block a user