Skip to content

Commit 2f94969

Browse files
committed
Refactor OrgPage component to include SidebarCard and BreadCrumbs, enhancing layout and organization information display
1 parent 664bc8e commit 2f94969

File tree

1 file changed

+79
-3
lines changed
  • app/[locale]/(user)/publishers/organization/[organizationSlug]

1 file changed

+79
-3
lines changed

app/[locale]/(user)/publishers/organization/[organizationSlug]/page.tsx

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,88 @@
1+
'use client';
2+
13
import React from 'react';
4+
import { useParams } from 'next/navigation';
5+
import { graphql } from '@/gql';
6+
import { useQuery } from '@tanstack/react-query';
27

8+
import { GraphQL } from '@/lib/api';
39
import { Loading } from '@/components/loading';
10+
import ProfileDetails from '../../components/ProfileDetails';
11+
import { Spinner } from 'opub-ui';
12+
import SidebarCard from '../../components/SidebarCard';
13+
import BreadCrumbs from '@/components/BreadCrumbs';
14+
15+
const orgInfoQuery: any = graphql(`
16+
query organizationData($id: String!) {
17+
organization(id: $id) {
18+
id
19+
created
20+
description
21+
contributedSectorsCount
22+
location
23+
twitterProfile
24+
githubProfile
25+
name
26+
logo {
27+
url
28+
}
29+
publishedUseCasesCount
30+
publishedDatasetsCount
31+
linkedinProfile
32+
}
33+
}
34+
`);
435

536
const OrgPage = () => {
37+
const params = useParams();
38+
const organizationInfo: any = useQuery([`${params.publisherSlug}`], () =>
39+
GraphQL(
40+
orgInfoQuery,
41+
{
42+
// Entity Headers if present
43+
},
44+
{ id: params.organizationSlug }
45+
)
46+
);
47+
648
return (
7-
<div>
8-
<Loading />
9-
</div>
49+
<main className="bg-primaryBlue">
50+
<BreadCrumbs
51+
data={[
52+
{ href: '/', label: 'Home' },
53+
{ href: '/publishers', label: 'Publishers' },
54+
{
55+
href: '#',
56+
label: `${organizationInfo?.data?.organization?.name || ''} `,
57+
},
58+
]}
59+
/>
60+
{
61+
<div className="container py-10 text-surfaceDefault">
62+
<div className="flex flex-wrap gap-10 lg:flex-nowrap">
63+
<div className="w-full lg:w-1/4">
64+
{organizationInfo?.isLoading ? (
65+
<div className="m-4 flex justify-center rounded-2 bg-surfaceDefault p-4">
66+
<Spinner color="highlight" />
67+
</div>
68+
) : (
69+
<SidebarCard data={organizationInfo?.data?.organization} type={'organization'}/>
70+
)}
71+
</div>
72+
<div className="w-full">
73+
{organizationInfo?.isLoading ? (
74+
<div className="m-4 flex justify-center rounded-2 bg-surfaceDefault p-4">
75+
<Spinner color="highlight" />
76+
</div>
77+
) : (
78+
<ProfileDetails data={organizationInfo?.data?.organization} type={'organization'}/>
79+
80+
)}
81+
</div>
82+
</div>
83+
</div>
84+
}
85+
</main>
1086
);
1187
};
1288

0 commit comments

Comments
 (0)