Communities and channels

This commit is contained in:
Aslan 2026-01-07 21:01:01 -05:00
parent 79dbeb6b7a
commit 280158470a
34 changed files with 558 additions and 62 deletions

View file

@ -1,7 +1,16 @@
import type { Component } from "solid-js";
import { IChannelProps } from "./types";
const Channel: Component = () => {
return <div></div>;
const Channel: Component<IChannelProps> = (props: IChannelProps) => {
return (
<li
class={`flex flex-row gap-2 items-center p-1 cursor-pointer rounded-lg ${props.active ? "bg-stone-700 hover:bg-stone-700" : "hover:bg-stone-800"}`}
onClick={() => props.onChannelClick(props.id)}
>
<div class="font-bold text-xl">&nbsp#</div>
<div class="font-bold">{props.name}</div>
</li>
);
};
export { Channel };

View file

@ -1 +1,2 @@
export * from "./Channel";
export * from "./types";

View file

@ -0,0 +1,8 @@
interface IChannelProps {
id: string;
name: string;
active: boolean;
onChannelClick: (id: string) => void;
}
export { type IChannelProps };

View file

@ -1,9 +1,15 @@
import type { Component } from "solid-js";
import { IChannelBarProps } from "./types";
const ChannelBar: Component = () => {
const ChannelBar: Component<IChannelBarProps> = (props: IChannelBarProps) => {
return (
<div class="absolute w-full top-0 z-10">
<div class="bg-stone-800/25 backdrop-blur-md h-16 w-full shadow-bar p-2"></div>
<div class="flex flex-col justify-center bg-stone-800/25 backdrop-blur-md h-16 w-full shadow-bar px-5">
<h2 class="text-sm font-bold">
{props.name ? `# ${props.name}` : undefined}
</h2>
<p class="text-xs">{props.description}</p>
</div>
</div>
);
};

View file

@ -1 +1,2 @@
export * from "./ChannelBar";
export * from "./types";

View file

@ -0,0 +1,7 @@
interface IChannelBarProps {
id?: string;
name?: string;
description?: string;
}
export { type IChannelBarProps };

View file

@ -7,7 +7,9 @@ const Community: Component<ICommunityProps> = (props: ICommunityProps) => {
class="avatar cursor-pointer"
onClick={() => props.onCommunityClick(props.id)}
>
<div class="w-full rounded-full">
<div
class={`w-full transition-[border-radius] duration-300 outline-stone-300 hover:outline-2 ${props.active ? "rounded-lg outline-2" : "rounded-4xl"}`}
>
<img src={props.avatar} />
</div>
</div>

View file

@ -2,6 +2,7 @@ interface ICommunityProps {
id: string;
name: string;
avatar: string;
active: boolean;
onCommunityClick: (id: string) => void;
}

View file

@ -0,0 +1,19 @@
import type { Component } from "solid-js";
import { ICommunityBarProps } from "./types";
const CommunityBar: Component<ICommunityBarProps> = (
props: ICommunityBarProps,
) => {
return (
<div
class={`absolute w-full top-0 z-10 bg-cover bg-top bg-no-repeat bg-[url('${props.avatar}')]`}
>
<div class="flex flex-col justify-center bg-stone-800/25 backdrop-blur-md h-16 w-full shadow-bar px-5">
<h2 class="text-sm font-bold">{props.name}</h2>
<p class="text-xs">{props.description}</p>
</div>
</div>
);
};
export { CommunityBar };

View file

@ -0,0 +1,2 @@
export * from "./CommunityBar";
export * from "./types";

View file

@ -0,0 +1,8 @@
interface ICommunityBarProps {
id?: string;
name?: string;
description?: string;
avatar?: string;
}
export { type ICommunityBarProps };

View file

@ -1,7 +1,20 @@
import type { Component } from "solid-js";
import { IMemberProps } from "./types";
const Member: Component = () => {
return <div></div>;
const Member: Component<IMemberProps> = (props: IMemberProps) => {
return (
<li
class={`flex flex-row gap-4 items-center p-1 cursor-pointer rounded-lg ${props.active ? "bg-stone-700 hover:bg-stone-700" : "hover:bg-stone-800"}`}
onClick={() => props.onMemberClick(props.id)}
>
<div class="avatar">
<div class="w-9 rounded-full">
<img src={props.avatar} />
</div>
</div>
<div class="font-bold">{props.username}</div>
</li>
);
};
export { Member };

View file

@ -1 +1,2 @@
export * from "./Member";
export * from "./types";

View file

@ -0,0 +1,9 @@
interface IMemberProps {
id: string;
username: string;
avatar: string;
active: boolean;
onMemberClick: (id: string) => void;
}
export { type IMemberProps };

View file

@ -3,7 +3,7 @@ import { IMessageProps } from "./types";
const Message: Component<IMessageProps> = (props: IMessageProps) => {
return (
<li class="list-row hover:bg-stone-700">
<li class="list-row p-3 hover:bg-stone-700">
<div
class="avatar cursor-pointer"
onClick={() => props.onProfileClick(props.userId)}

View file

@ -1,4 +1,5 @@
import type { Component } from "solid-js";
import { state } from "../../store/state";
const MessageBar: Component = () => {
return (