Skip to content

Commit

Permalink
fix: update logic to show subsidy cards
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinan029 committed Sep 25, 2024
1 parent 28257fe commit b31c46a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CustomerPlanContainer = ({
}) => {
const [showInactive, setShowInactive] = useState(false);
const countOfActivePlans = activeSubscriptions.length + activeSubsidies.length;
const countOfInactivePlans = inactiveSubscriptions.length + activeSubsidies.length;
const countOfInactivePlans = inactiveSubscriptions.length + inactiveSubsidies.length;
const countOfAllPlans = countOfActivePlans + countOfInactivePlans;
useEffect(() => {
if (!countOfActivePlans && countOfAllPlans) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ const CustomerViewContainer = () => {
}, [fetchData]);

const renderPlanContainer = () => {
if (!isLoading && !associatedPlans.isLoading && associatedPlans.countOfAllPlans) {
if (!isLoading && !associatedPlans.isLoading
&& (associatedPlans.activeSubsidies.length > 0 || associatedPlans.activeSubscriptions.length > 0)) {
return (
<Stack gap={2}>
<CustomerPlanContainer slug={enterpriseCustomer.slug} {...associatedPlans} />
</Stack>
);
}
if (!associatedPlans.isLoading && !associatedPlans.countOfAllPlans) {
if (!associatedPlans.isLoading
&& (!associatedPlans.activeSubsidies.length || !associatedPlans.activeSubscriptions.length)) {
return false;
}
if (associatedPlans.isLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ describe('CustomerPlanContainer', () => {
expirationDate: '2024-09-02T20:02:57.651943Z',
uuid: 'test-uuid',
}],
countOfActivePlans: 2,
countOfAllPlans: 3,
inactiveSubscriptions: [],
inactiveSubsidies: [{
activeDatetime: '2024-08-23T20:02:57.651943Z',
Expand Down

0 comments on commit b31c46a

Please sign in to comment.