|
| 1 | +'use client'; |
| 2 | + |
1 | 3 | import React from 'react'; |
| 4 | +import { useParams } from 'next/navigation'; |
| 5 | +import { graphql } from '@/gql'; |
| 6 | +import { useQuery } from '@tanstack/react-query'; |
2 | 7 |
|
| 8 | +import { GraphQL } from '@/lib/api'; |
3 | 9 | 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 | +`); |
4 | 35 |
|
5 | 36 | 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 | + |
6 | 48 | 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> |
10 | 86 | ); |
11 | 87 | }; |
12 | 88 |
|
|
0 commit comments