Skip to content

Commit

Permalink
frontend fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
twallnerWaretec committed Jun 20, 2024
1 parent 4e376bb commit bc19969
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 37 deletions.
6 changes: 1 addition & 5 deletions packages/repco-frontend/app/graphql/queries/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ export const DashboardQuery = gql`
totalCount
nodes {
name
contentItems(
filter: {
pubDate: { greaterThanOrEqualTo: $start, lessThanOrEqualTo: $end }
}
) {
contentItems {
totalCount
}
}
Expand Down
107 changes: 76 additions & 31 deletions packages/repco-frontend/app/routes/__layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export const loader: LoaderFunction = async ({ request }) => {
publicationServicesNodes = top10
}

const labels = publicationServicesNodes.map((item) => item.name[Object.keys(item.name)[0]]['value'])
const labels = publicationServicesNodes.map(
(item) => item.name[Object.keys(item.name)[0]]['value'],
)
const dataPoints = publicationServicesNodes.map(
(item) => item.contentItems?.totalCount,
)
Expand Down Expand Up @@ -119,7 +121,7 @@ export const loader: LoaderFunction = async ({ request }) => {
}

const filteredRepoStats = repoStats.filter((result) => result !== null)

return {
data,
repoChartData,
Expand Down Expand Up @@ -177,8 +179,12 @@ export default function Index() {
(node: any, index: number) => (
<li key={index}>
<NavLink to={`/items/${node.uid}`}>
{node.title[Object.keys(node?.title)[0]]['value'].length > 20
? node.title[Object.keys(node?.title)[0]]['value'].slice(0, 45) + '...'
{node.title[Object.keys(node?.title)[0]]['value'].length >
20
? node.title[Object.keys(node?.title)[0]]['value'].slice(
0,
45,
) + '...'
: node.title[Object.keys(node?.title)[0]]['value']}
</NavLink>
</li>
Expand Down Expand Up @@ -216,11 +222,20 @@ export default function Index() {
<ContentItemCard
aria-label={`Repository ${repo.name} with DID ${repo.did}`}
>
<div className="flex items-baseline space-x-4">
<h3 className="text-brand-primary text-lg" key={i}>
<div
className="flex items-baseline space-x-4"
style={{ alignItems: 'center' }}
>
<h3
className="text-brand-primary text-lg"
key={i}
style={{ alignItems: 'center' }}
>
{repo.name}
</h3>
<span className="text-xs italic">({repoChartData.datasets[0].data[i]}) {repo.did}</span>
<span className="text-xs italic">
({repoChartData.datasets[0].data[i]}) {repo.did}
</span>
</div>
</ContentItemCard>
</NavLink>
Expand All @@ -230,41 +245,68 @@ export default function Index() {
</div>

<div>
<h3 className="text-2xl">Datasources ({data?.dataSources.totalCount})</h3>
<h3 className="text-2xl">
Datasources ({data?.dataSources.totalCount})
</h3>
<div className="flex flex-col p-1">
{data?.dataSources.nodes.map(
(ds: { config: any; }, i: number) => (
<a key={i} href={ds.config.url} target={'_blank'}>
<ContentItemCard
aria-label={`Datasource ${ds.config.name}`}
{data?.dataSources.nodes.map((ds: { config: any }, i: number) => (
<a key={i} href={ds.config.url} target={'_blank'}>
<ContentItemCard aria-label={`Datasource ${ds.config.name}`}>
<div
className="flex items-baseline space-x-4"
style={{ alignItems: 'center' }}
>
<div className="flex items-baseline space-x-4">
<h3 className="text-brand-primary text-lg" key={i} style={{display: 'flex'}}>
<img src={ds.config.thumbnail} style={{display: 'block', margin: 'auto', paddingRight: '8px'}} />
{ds.config.name}
</h3>
<span className="text-xs italic">{ds.config.endpoint}</span>
</div>
</ContentItemCard>
</a>
),
)}
<h3
className="text-brand-primary text-lg"
key={i}
style={{ display: 'flex', alignItems: 'center' }}
>
<img
src={ds.config.thumbnail}
style={{
display: 'block',
margin: 'auto',
paddingRight: '8px',
width: '100px',
height: 'auto',
}}
/>
{ds.config.name}
</h3>
<span className="text-xs italic">{ds.config.url}</span>
</div>
</ContentItemCard>
</a>
))}
</div>
</div>

<div>
<h3 className="text-2xl">Publication Services ({data?.publicationServices.totalCount})</h3>
<h3 className="text-2xl">
Publication Services ({data?.publicationServices.totalCount})
</h3>
<div className="flex flex-col p-1">
{data?.publicationServices.nodes.map(
(ps: { name: any; contentItems: any }, i: number) => (
<ContentItemCard
aria-label={`Publicationservice ${ps.name[Object.keys(ps.name)[0]].value}`}
aria-label={`Publicationservice ${
ps.name[Object.keys(ps.name)[0]].value
}`}
>
<div className="flex items-baseline space-x-4">
<h3 className="text-brand-primary text-lg" key={i} style={{display: 'flex'}}>
<div
className="flex items-baseline space-x-4"
style={{ alignItems: 'center' }}
>
<h3
className="text-brand-primary text-lg"
key={i}
style={{ display: 'flex', alignItems: 'center' }}
>
{ps.name[Object.keys(ps.name)[0]].value}
</h3>
<span className="text-xs italic">({ps.contentItems.totalCount})</span>
<span className="text-xs italic">
({ps.contentItems.totalCount})
</span>
</div>
</ContentItemCard>
),
Expand Down Expand Up @@ -293,9 +335,12 @@ export default function Index() {
</a>
</div>
</div>
<div className="flex flex-col w-1/3 space-y-2" style={{marginBottom: '8px'}}>
<div
className="flex flex-col w-1/3 space-y-2"
style={{ marginBottom: '8px' }}
>
<h4 className="text-xl">And kindly supported by:</h4>
<div className='flex'>
<div className="flex">
<a className="flex w-1/3" href="https://culturalfoundation.eu">
<img
className=" object-contain"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const RevisionsByEntityUris = makeAddPgTableConditionPlugin(
if (value == null) return
const { sql, sqlTableAlias } = helpers
var inValues = value.split(',')
return sql.raw(`uid IN ('{${inValues.join(`}','{`)}}')`)
return sql.raw(`entityUris IN ('{${inValues.join(`}','{`)}}')`)
},
)

Expand Down

0 comments on commit bc19969

Please sign in to comment.