🔄 ✨ Forum overhaul: Phora → Arbor (#1)
🔧 Replace legacy system with NIP-BB implementation 🚀 Enhance forum user experience with improved navigation and interactions 🎨 Redesign UI for forum 🏷️ Rebrand from "Phora" to "Arbor"
This commit is contained in:
parent
2a1447cd77
commit
5afeb4d01a
19 changed files with 1233 additions and 610 deletions
78
src/components/Arbor/Button.ts
Normal file
78
src/components/Arbor/Button.ts
Normal file
|
@ -0,0 +1,78 @@
|
|||
import { LitElement, css, html } from 'lit';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
|
||||
import '@components/EveLink';
|
||||
|
||||
@customElement('arx-arbor-button')
|
||||
export class ArborButton extends LitElement {
|
||||
@property({ type: String }) href = '';
|
||||
@property({ type: String }) target = '';
|
||||
@property({ type: String }) rel = '';
|
||||
@property({ type: Boolean }) disabled = false;
|
||||
|
||||
get hrefValue() {
|
||||
if (!this.href || this.disabled) return 'javascript:void(0)';
|
||||
return this.href;
|
||||
}
|
||||
|
||||
static override styles = [
|
||||
css`
|
||||
arx-eve-link::part(link) {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
arx-eve-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--accent);
|
||||
border: none;
|
||||
padding: 0.75rem 0.75rem;
|
||||
border-radius: 0.25rem;
|
||||
text-decoration: none;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease-in-out;
|
||||
box-shadow: var(--shadow-sm);
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
arx-eve-link:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
|
||||
background: color-mix(in oklch, var(--accent), black 15%);
|
||||
}
|
||||
|
||||
arx-eve-link:focus {
|
||||
outline: none;
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
arx-eve-link:active {
|
||||
transform: translateY(0);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
arx-eve-link.disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
override render() {
|
||||
return html`
|
||||
<arx-eve-link
|
||||
.href=${this.hrefValue}
|
||||
.target=${this.target}
|
||||
.rel=${this.rel}
|
||||
class="${this.disabled ? 'disabled' : ''}"
|
||||
>
|
||||
<slot></slot>
|
||||
</arx-eve-link>
|
||||
`;
|
||||
}
|
||||
}
|
46
src/components/Arbor/ForumCategory.ts
Normal file
46
src/components/Arbor/ForumCategory.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { LitElement, css, html } from 'lit';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
|
||||
@customElement('arx-arbor-forum-category')
|
||||
export class ArborForumCategory extends LitElement {
|
||||
@property({ type: String }) override title = '';
|
||||
@property({ type: String }) override id = '';
|
||||
|
||||
static override styles = [
|
||||
css`
|
||||
.forum-category {
|
||||
background: oklch(100% 0 0);
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: var(--shadow-xl);
|
||||
margin-block-end: 1.5rem;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
background: var(--primary);
|
||||
color: oklch(100% 0 0);
|
||||
padding: 1rem 1.5rem;
|
||||
border-radius: 0.5rem 0.5rem 0 0;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
override render() {
|
||||
return html`
|
||||
<div class="forum-category">
|
||||
<div class="category-header">
|
||||
<span>${this.title}</span>
|
||||
<arx-arbor-button href="/arbor/new-topic/${this.id}">
|
||||
New Topic
|
||||
</arx-arbor-button>
|
||||
</div>
|
||||
<slot>
|
||||
<div style="padding: 1rem 1.5rem">No topics...</div>
|
||||
</slot>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
341
src/components/Arbor/ForumPost.ts
Normal file
341
src/components/Arbor/ForumPost.ts
Normal file
|
@ -0,0 +1,341 @@
|
|||
import formatDateTime from '@utils/formatDateTime';
|
||||
import { LitElement, css, html } from 'lit';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
|
||||
import '@components/MarkdownContent';
|
||||
|
||||
@customElement('arx-forum-post')
|
||||
export class ForumPost extends LitElement {
|
||||
@property({ type: String }) override id = '';
|
||||
@property({ type: String }) topicId = '';
|
||||
@property({ type: String }) npub = '';
|
||||
@property({ type: Date }) date = new Date();
|
||||
@property({ type: String }) content = '';
|
||||
@property({ type: Boolean }) isHighlighted = false;
|
||||
|
||||
static override styles = [
|
||||
css`
|
||||
.post {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
border-radius: 16px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04),
|
||||
0 1px 3px rgba(0, 0, 0, 0.03);
|
||||
margin-block-end: 0.75rem;
|
||||
overflow: hidden;
|
||||
transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
isolation: isolate;
|
||||
will-change: transform;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(2px);
|
||||
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.07),
|
||||
0 2px 4px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
}
|
||||
|
||||
.post--highlighted {
|
||||
position: relative;
|
||||
border-inline-start: none;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset-inline-start: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
background: #4361ee;
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.post__sidebar {
|
||||
padding: clamp(1rem, 4vw, 1.5rem);
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.06);
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.01);
|
||||
}
|
||||
|
||||
.post__main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.post__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1rem clamp(1rem, 4vw, 1.5rem);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||
background: rgba(0, 0, 0, 0.01);
|
||||
backdrop-filter: blur(8px);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.post__time {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
font-weight: 500;
|
||||
|
||||
& iconify-icon {
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
.post__permalink {
|
||||
margin-inline-start: auto;
|
||||
color: #4361ee;
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: rgba(67, 97, 238, 0.08);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid #4361ee;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.post__content {
|
||||
padding: clamp(1.25rem, 5vw, 1.75rem);
|
||||
line-height: 1.7;
|
||||
color: rgba(0, 0, 0, 0.87);
|
||||
overflow-wrap: break-word;
|
||||
flex: 1;
|
||||
font-size: clamp(0.95rem, 2vw, 1rem);
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.post__actions {
|
||||
display: flex;
|
||||
padding: 0.75rem clamp(0.75rem, 3vw, 1.25rem);
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
||||
gap: clamp(0.5rem, 2vw, 0.75rem);
|
||||
background: rgba(0, 0, 0, 0.01);
|
||||
}
|
||||
|
||||
.action-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
font-family: inherit;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
& iconify-icon {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
color: rgba(0, 0, 0, 0.87);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid rgba(0, 0, 0, 0.2);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
&:active:not(:disabled) {
|
||||
transform: translateY(1px) scale(0.98);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.action-button--primary {
|
||||
color: #4361ee;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: rgba(67, 97, 238, 0.08);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline-color: #4361ee;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.post {
|
||||
flex-direction: column;
|
||||
margin-inline: -1rem;
|
||||
border-radius: 0;
|
||||
margin-block-end: 1.5rem;
|
||||
}
|
||||
|
||||
.post__sidebar {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||
padding: 1rem;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
padding: 0.625rem;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
border-radius: 10px;
|
||||
|
||||
& span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.post__actions {
|
||||
justify-content: space-between;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.post__content {
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
private _handleReply() {
|
||||
alert('Replying is not yet implemented');
|
||||
this.dispatchEvent(
|
||||
new CustomEvent('reply', {
|
||||
detail: { postId: this.id, npub: this.npub },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private _handleZap() {
|
||||
alert('Zapping is not yet implemented');
|
||||
this.dispatchEvent(
|
||||
new CustomEvent('zap', {
|
||||
detail: { postId: this.id, npub: this.npub },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private _handleDownzap() {
|
||||
alert('Downzapping is not yet implemented');
|
||||
this.dispatchEvent(
|
||||
new CustomEvent('downzap', {
|
||||
detail: { postId: this.id, npub: this.npub },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private _copyPermalink() {
|
||||
const permalink = `eve://phora/topics/${this.topicId}#post-${this.id}`;
|
||||
navigator.clipboard.writeText(permalink);
|
||||
}
|
||||
|
||||
override render() {
|
||||
const permalink = `eve://phora/topics/${this.topicId}#post-${this.id}`;
|
||||
|
||||
const postClasses = {
|
||||
post: true,
|
||||
'post--highlighted': this.isHighlighted,
|
||||
};
|
||||
|
||||
return html`
|
||||
<div class=${classMap(postClasses)} id="post-${this.id}">
|
||||
<div class="post__sidebar">
|
||||
<arx-nostr-profile
|
||||
.npub=${this.npub}
|
||||
renderType="large"
|
||||
></arx-nostr-profile>
|
||||
</div>
|
||||
|
||||
<div class="post__main">
|
||||
<div class="post__header">
|
||||
<div class="post__time">
|
||||
<iconify-icon icon="mdi:clock-outline"></iconify-icon>
|
||||
${formatDateTime(this.date)}
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="post__permalink"
|
||||
title="Copy permalink"
|
||||
@click=${this._copyPermalink}
|
||||
>
|
||||
<iconify-icon icon="mdi:link-variant"></iconify-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="post__content">
|
||||
<arx-markdown-content
|
||||
.content=${this.content || 'No content available'}
|
||||
></arx-markdown-content>
|
||||
</div>
|
||||
|
||||
<div class="post__actions">
|
||||
<button
|
||||
class="action-button action-button--primary"
|
||||
@click=${this._handleReply}
|
||||
disabled
|
||||
>
|
||||
<iconify-icon icon="mdi:reply"></iconify-icon>
|
||||
<span>Reply</span>
|
||||
</button>
|
||||
|
||||
<a href=${permalink} class="action-button">
|
||||
<iconify-icon icon="mdi:link-variant"></iconify-icon>
|
||||
<span>Permalink</span>
|
||||
</a>
|
||||
|
||||
<button class="action-button" @click=${this._handleZap} disabled>
|
||||
<iconify-icon icon="mdi:lightning-bolt"></iconify-icon>
|
||||
<span>Zap</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="action-button"
|
||||
@click=${this._handleDownzap}
|
||||
disabled
|
||||
>
|
||||
<iconify-icon icon="mdi:lightning-bolt-outline"></iconify-icon>
|
||||
<span>Downzap</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
196
src/components/Arbor/ForumTopic.ts
Normal file
196
src/components/Arbor/ForumTopic.ts
Normal file
|
@ -0,0 +1,196 @@
|
|||
import { LitElement, css, html } from 'lit';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
|
||||
import '@components/EveLink';
|
||||
import formatDateTime from '@/utils/formatDateTime';
|
||||
|
||||
@customElement('arx-arbor-forum-topic')
|
||||
export class ArborForumTopic extends LitElement {
|
||||
static override styles = [
|
||||
css`
|
||||
.topic {
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 1fr;
|
||||
padding: 1.75rem;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 1rem;
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.topic:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.topic-icon {
|
||||
inline-size: 40px;
|
||||
block-size: 40px;
|
||||
background: var(--accent);
|
||||
border-radius: 10px;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.topic-icon::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(
|
||||
45deg,
|
||||
transparent,
|
||||
oklch(from var(--accent) l c h / 0.2)
|
||||
);
|
||||
}
|
||||
|
||||
.topic-info {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.topic-details {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
arx-eve-link::part(link) {
|
||||
display: inline-block;
|
||||
margin-bottom: 0.875rem;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
text-decoration: none;
|
||||
color: var(--primary);
|
||||
transition: all 0.2s ease;
|
||||
&:hover {
|
||||
color: var(--secondary);
|
||||
transform: translateX(4px);
|
||||
}
|
||||
}
|
||||
|
||||
.topic-details p {
|
||||
margin: 0;
|
||||
font-size: 0.975rem;
|
||||
line-height: 1.6;
|
||||
color: var(--secondary);
|
||||
}
|
||||
|
||||
.new-status {
|
||||
position: relative;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.new-status::after {
|
||||
content: "New";
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -40px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
background: var(--accent);
|
||||
color: var(--light);
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.hot-status {
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.hot-status::before {
|
||||
content: "🔥";
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
.stats-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding-left: 1.5rem;
|
||||
border-left: 2px solid var(--border);
|
||||
}
|
||||
|
||||
.last-post-section {
|
||||
background: oklch(from var(--primary) 98% calc(c * 0.2) h);
|
||||
padding: 0.875rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.last-post-section > div:first-of-type {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--secondary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.last-post-info {
|
||||
color: var(--secondary);
|
||||
font-size: 0.875rem;
|
||||
margin-top: 0.625rem;
|
||||
padding-top: 0.625rem;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
@media (max-width: 968px) {
|
||||
.topic {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1.5rem;
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.stats-container {
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
padding-top: 1rem;
|
||||
border-top: 2px solid var(--border);
|
||||
}
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@property({ type: String }) override id = '';
|
||||
@property({ type: String }) override title = '';
|
||||
@property({ type: String }) description = '';
|
||||
@property({ type: String }) lastPostBy = '';
|
||||
@property({ type: String }) lastPostTime = '';
|
||||
@property({ type: Boolean }) isNew = false;
|
||||
@property({ type: Boolean }) isHot = false;
|
||||
|
||||
get status() {
|
||||
if (this.isNew) return 'new-status';
|
||||
if (this.isHot) return 'hot-status';
|
||||
return '';
|
||||
}
|
||||
|
||||
override render() {
|
||||
return html`
|
||||
<div class="topic">
|
||||
<div class="topic-info">
|
||||
<div class="topic-icon"></div>
|
||||
<div class="topic-details">
|
||||
<arx-eve-link
|
||||
class="${this.status}"
|
||||
href="/arbor/topics/${this.id}"
|
||||
>
|
||||
${this.title}
|
||||
</arx-eve-link>
|
||||
<p>${this.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats-container">
|
||||
<div class="last-post-section">
|
||||
<arx-nostr-profile npub="${this.lastPostBy}"></arx-nostr-profile>
|
||||
<div class="last-post-info">
|
||||
${formatDateTime(this.lastPostTime)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue