Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/admin-x-framework/src/api/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type MemberCountHistoryResponseType = {
paid: number;
free: number;
comped: number;
gift: number;
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-x-framework/src/test/msw-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const fixtures = {
{date: '2024-01-01', paid: 100, free: 500, comped: 10, paid_subscribed: 5, paid_canceled: 2},
{date: '2024-01-02', paid: 102, free: 505, comped: 10, paid_subscribed: 3, paid_canceled: 1}
],
meta: {totals: {paid: 102, free: 505, comped: 10}}
meta: {totals: {paid: 102, free: 505, comped: 10, gift: 8}}
},

mrrHistory: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"totals": {
"paid": 110,
"free": 530,
"comped": 12
"comped": 12,
"gift": 8
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {useEffect, useId, useState} from 'react';
import useFeatureFlag from '../../../../hooks/use-feature-flag';
import {Button, List, ListItem, ModalPage, Select, TextField} from '@tryghost/admin-x-design-system';
import {getHomepageUrl} from '@tryghost/admin-x-framework/api/site';
import {getPaidActiveTiers, useBrowseTiers} from '@tryghost/admin-x-framework/api/tiers';
Expand Down Expand Up @@ -38,6 +39,7 @@ const PortalLinks: React.FC = () => {
const {siteData} = useGlobalData();
const {data: {tiers: allTiers} = {}} = useBrowseTiers();
const tiers = getPaidActiveTiers(allTiers || []);
const hasGiftSubscriptions = useFeatureFlag('giftSubscriptions');

const toggleIsDataAttributes = () => {
setIsDataAttributes(!isDataAttributes);
Expand Down Expand Up @@ -66,6 +68,7 @@ const PortalLinks: React.FC = () => {
<PortalLink name='Default' value={isDataAttributes ? 'data-portal' : `${homePageURL}#/portal`} />
<PortalLink name='Sign in' value={isDataAttributes ? 'data-portal="signin"' : `${homePageURL}#/portal/signin`} />
<PortalLink name='Sign up' value={isDataAttributes ? 'data-portal="signup"' : `${homePageURL}#/portal/signup`} />
{hasGiftSubscriptions && <PortalLink name='Gift' value={isDataAttributes ? 'data-portal="gift"' : `${homePageURL}#/portal/gift`} />}
</List>

<List className='mt-14' title='Tiers' titleSize='lg'>
Expand Down
2 changes: 1 addition & 1 deletion apps/portal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tryghost/portal",
"version": "2.68.10",
"version": "2.68.11",
"license": "MIT",
"repository": "https://github.com/TryGhost/Ghost",
"author": "Ghost Foundation",
Expand Down
8 changes: 5 additions & 3 deletions apps/portal/src/components/pages/share/share-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ const ShareModal = () => {
// correct document context where the click events actually fire.
const doc = moreMenuRef.current?.ownerDocument || document;

const onDocumentMouseDown = (event) => {
const onDocumentClickCapture = (event) => {
if (moreMenuRef.current && !moreMenuRef.current.contains(event.target)) {
event.stopPropagation();
event.preventDefault();
setIsMoreMenuOpen(false);
}
};
Expand All @@ -50,11 +52,11 @@ const ShareModal = () => {
}
};

doc.addEventListener('mousedown', onDocumentMouseDown);
doc.addEventListener('click', onDocumentClickCapture, true);
doc.addEventListener('keydown', onDocumentKeyDown);

return () => {
doc.removeEventListener('mousedown', onDocumentMouseDown);
doc.removeEventListener('click', onDocumentClickCapture, true);
doc.removeEventListener('keydown', onDocumentKeyDown);
};
}, [isMoreMenuOpen]);
Expand Down
12 changes: 8 additions & 4 deletions apps/portal/src/components/pages/share/share-modal.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ export const ShareModalStyles = `
top: 20px;
}

@media (max-width: 480px) {
.gh-portal-popup-container.share {
flex: 1 0 auto;
margin-bottom: 0;
}
}

@media (max-width: 420px) {
.gh-portal-share-actions {
flex-direction: column;
Expand Down Expand Up @@ -292,11 +299,8 @@ export const ShareModalStyles = `
order: 4;
}

.gh-portal-share-action.more {
order: 5;
}

.gh-portal-share-more {
order: 5;
width: 100%;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/portal/test/unit/components/pages/share-modal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('ShareModal', () => {
expect(getByRole('menu')).toBeInTheDocument();
expect(moreButton).toHaveAttribute('aria-expanded', 'true');

fireEvent.mouseDown(getByText('Share'));
fireEvent.click(getByText('Share'));
expect(queryByRole('menu')).not.toBeInTheDocument();
expect(moreButton).toHaveAttribute('aria-expanded', 'false');

Expand Down
8 changes: 4 additions & 4 deletions ghost/admin/app/components/posts-list/selection-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export default class SelectionList {
}

const models = this.infinityModel;
let total;
let total = 0;
for (const key in models) {
total += models[key].meta?.pagination?.total;
}
return Math.max((total ?? 0) - this.selectedIds.size, 1);
total += models[key].meta?.pagination?.total ?? 0;
}
return Math.max(total - this.selectedIds.size, 1);
}

isSelected(id) {
Expand Down
7 changes: 4 additions & 3 deletions ghost/core/core/frontend/utils/member-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ const {api} = require('../services/proxy');
* free: number;
* paid: number;
* comped: number;
* gift: number;
* total: number;
* }>}
*/
async function getMemberStats() {
let memberStats = this.data || await api.stats.memberCountHistory.query();
const {free, paid, comped} = memberStats.meta.totals;
let total = free + paid + comped;
return {free, paid, comped, total};
const {free, paid, comped, gift} = memberStats.meta.totals;
let total = free + paid + comped + gift;
return {free, paid, comped, gift, total};
}

/**
Expand Down
Loading