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,6 +1,7 @@
import { createMemo, type Component } from "solid-js";
import { Community } from "../../components/Community";
import { state } from "../../store/state";
import { dispatch, state } from "../../store/state";
import { CommunityActionTypes } from "../../store/community";
const CommunityView: Component = () => {
const communityIds = createMemo(() => {
@ -18,7 +19,14 @@ const CommunityView: Component = () => {
});
const onCommunityClick = (id: string) => {
console.log(id);
dispatch({
type: CommunityActionTypes.FETCH_COMMUNITY_START,
payload: id,
});
dispatch({
type: CommunityActionTypes.SET_ACTIVE_COMMUNITY,
payload: id,
});
};
const mapCommunity = (communityId: string) => {
@ -34,16 +42,15 @@ const CommunityView: Component = () => {
avatar={
"https://img.daisyui.com/images/profile/demo/yellingcat@192.webp"
}
active={community.id === state.community.active}
onCommunityClick={onCommunityClick}
/>
);
};
return (
<div class="p-3 h-full">
<div class="bg-stone-950 w-20 h-full rounded-full shadow-panel z-30 flex flex-col p-3 gap-3">
{communityIds().map(mapCommunity)}
</div>
<div class="bg-stone-950 w-18 h-full shadow-panel z-30 flex flex-col p-2 gap-2">
{communityIds().map(mapCommunity)}
</div>
);
};