Skip to content

Commit

Permalink
WIP: Basic create and read ops for community, posts and comments; Com…
Browse files Browse the repository at this point in the history
…munity pages
  • Loading branch information
Rajat Saxena committed Dec 14, 2024
1 parent 3a8f727 commit 0a7bdf8
Show file tree
Hide file tree
Showing 121 changed files with 6,687 additions and 485 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/blog/[id]/blog-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function BlogLayout({
}) {
const address = useContext(AddressContext);
const siteinfo = useContext(SiteInfoContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

if (
!checkPermission(profile.permissions!, [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/blog/[id]/details/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useContext } from "react";

export default function Page({ params }: { params: { id: string } }) {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const { id } = params;

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/blog/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ReactNode, useContext } from "react";
const { permissions } = UIConstants;

export default function Page({ children }: { children: ReactNode }) {
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

if (
!checkPermission(profile.permissions!, [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/blogs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { permissions } = UIConstants;

export default function Page() {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const siteinfo = useContext(SiteInfoContext);

if (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/mails/mail-hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { permissions } = UIConstants;

export default function MailHub() {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const searchParams = useSearchParams();

const tab = searchParams?.get("tab") || "Broadcasts";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/my-content/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Page() {
const [courses, setCourses] = useState([]);
const [loaded, setLoaded] = useState(false);

const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const address = useContext(AddressContext);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/overview/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useContext } from "react";
export default function Page() {
const siteInfo = useContext(SiteInfoContext);
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

if (
!checkPermission(profile.permissions!, [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/pages/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { permissions } = UIConstants;

export default function Page() {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

if (!checkPermission(profile.permissions!, [permissions.manageSite])) {
return <LoadingScreen />;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/product/[id]/details/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useContext } from "react";

export default function Page({ params }: { params: { id: string } }) {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const { id } = params;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function Page({
params: { id: string; section: string; lesson: string };
}) {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const { id, section, lesson } = params;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function Page({
params: { id: string; section: string };
}) {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const { id, section } = params;

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/product/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ReactNode, useContext } from "react";
const { permissions } = UIConstants;

export default function Page({ children }: { children: ReactNode }) {
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

if (
!checkPermission(profile.permissions!, [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/products/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { permissions } = UIConstants;

export default function Page() {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const siteinfo = useContext(SiteInfoContext);

if (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function Page() {
const [avatar, setAvatar] = useState<Partial<Media>>({});
const [subscribedToUpdates, setSubscribedToUpdates] = useState(false);

const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const address = useContext(AddressContext);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { permissions } = UIConstants;
export default function Page() {
const siteinfo = useContext(SiteInfoContext);
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const searchParams = useSearchParams();

const tab = searchParams?.get("tab") || "Branding";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard2/users/users-hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function UsersHub() {
const [count, setCount] = useState(0);
const router = useRouter();

const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

const loadUsers = useCallback(async () => {
const query =
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard4/(sidebar)/blog/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Page({ params }: { params: { id: string } }) {
const searchParams = useSearchParams();
const [tab, setTab] = useState(searchParams?.get("tab") || "Details");
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const course = useCourse(id, address);
const router = useRouter();

Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard4/(sidebar)/blog/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ReactNode, useContext } from "react";
const { permissions } = UIConstants;

export default function Page({ children }: { children: ReactNode }) {
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);

if (
!checkPermission(profile.permissions!, [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard4/(sidebar)/blogs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const breadcrumbs = [{ label: MANAGE_BLOG_PAGE_HEADING, href: "#" }];

export default function Page() {
const address = useContext(AddressContext);
const profile = useContext(ProfileContext);
const { profile } = useContext(ProfileContext);
const siteinfo = useContext(SiteInfoContext);

if (
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { COMMUNITY_MEMBERSHIP_LIST_HEADER } from "@ui-config/strings";
import type { Metadata, ResolvingMetadata } from "next";
import { ReactNode } from "react";

export async function generateMetadata(
_: any,
parent: ResolvingMetadata,
): Promise<Metadata> {
return {
title: `${COMMUNITY_MEMBERSHIP_LIST_HEADER} | ${(await parent)?.title?.absolute}`,
};
}

export default function Layout({ children }: { children: ReactNode }) {
return children;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import DashboardContent from "@components/admin/dashboard-content";
import { MembershipList } from "@components/community/membership-list";
import {
COMMUNITY_HEADER,
COMMUNITY_MEMBERSHIP_LIST_HEADER,
} from "@ui-config/strings";

export default function Page({
params,
}: {
params: {
id: string;
};
}) {
const { id } = params;
const breadcrumbs = [
{
label: COMMUNITY_HEADER,
href: `/dashboard4/community/${id}`,
},
{ label: COMMUNITY_MEMBERSHIP_LIST_HEADER, href: "#" },
];
return (
<DashboardContent breadcrumbs={breadcrumbs}>
<MembershipList id={id} />
</DashboardContent>
);
}
20 changes: 20 additions & 0 deletions apps/web/app/dashboard4/(sidebar)/community/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client";

import DashboardContent from "@components/admin/dashboard-content";
import { CommunityForum } from "@components/community";
import { COMMUNITY_HEADER } from "@ui-config/strings";
import { useSearchParams } from "next/navigation";

const breadcrumbs = [{ label: COMMUNITY_HEADER, href: "#" }];

export default function Page({ params }: { params: { id: string } }) {
const { id } = params;
const searchParams = useSearchParams();
const category = searchParams?.get("category") || "All";

return (
<DashboardContent breadcrumbs={breadcrumbs}>
<CommunityForum id={id} activeCategory={category} />
</DashboardContent>
);
}
Loading

0 comments on commit 0a7bdf8

Please sign in to comment.