Skip to content

Commit

Permalink
Merge pull request #598 from subquery/fix/my-plans-sort
Browse files Browse the repository at this point in the history
feat(SQN-2093): add sort for my plans
  • Loading branch information
HuberTRoy authored Nov 21, 2023
2 parents 84cfd10 + f301070 commit c2653c7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
8 changes: 7 additions & 1 deletion src/pages/indexer/MyPlans/Default/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ export const Default: React.FC = () => {
infoI18nKey={'indexerPlans.learnMore'}
/>
),
data: (data) => <List data={data} onRefresh={plans.refetch} title={t('plans.default.title')} />,
data: (data) => (
<List
data={data.sort((a, b) => parseInt(a.id || '0x00', 16) - parseInt(b.id || '0x00', 16))}
onRefresh={plans.refetch}
title={t('plans.default.title')}
/>
),
},
)}
</div>
Expand Down
37 changes: 21 additions & 16 deletions src/pages/indexer/MyPlans/Specific/Specific.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,29 @@ const Specific: React.FC = () => {
<>
<Typography variant="h6">{t('plans.specific.title')}</Typography>
<div className={styles.plans}>
{deployments.map((deployment) => {
if (!deployment) return null;
const plans = deployment?.plans.nodes.filter(notEmpty);
{deployments
.sort((a, b) => parseInt(a?.project?.id || '0x00', 16) - parseInt(b?.project?.id || '0x00', 16))
.map((deployment) => {
if (!deployment) return null;
const plans = deployment?.plans.nodes.filter(notEmpty);

return (
<div key={deployment.id} className={styles.plan}>
<div className={styles.header}>
<DeploymentMeta deploymentId={deployment.id} projectMetadata={deployment.project?.metadata} />
</div>
return (
<div key={deployment.id} className={styles.plan}>
<div className={styles.header}>
<DeploymentMeta
deploymentId={deployment.id}
projectMetadata={deployment.project?.metadata}
/>
</div>

{plans ? (
<List data={plans} onRefresh={specificPlans.refetch} />
) : (
<Typography>{t('plans.specific.nonDeployment')}</Typography>
)}
</div>
);
})}
{plans ? (
<List data={plans} onRefresh={specificPlans.refetch} />
) : (
<Typography>{t('plans.specific.nonDeployment')}</Typography>
)}
</div>
);
})}
</div>
</>
);
Expand Down

0 comments on commit c2653c7

Please sign in to comment.