0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Wired up date-created to Offer Analytics (#19018)

no issue

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset)
Generated by Copilot at c7304ac</samp>

This pull request adds the `created_at` property to the `Offer` type and
displays it in the `EditOfferModal` component. This allows the admin to
see when an offer was created.
This commit is contained in:
Ronald Langeveld 2023-11-16 18:05:24 +07:00 committed by GitHub
parent 3a78cf48c9
commit 17f8844134
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -19,7 +19,8 @@ export type Offer = {
tier: {
id: string;
name?: string;
}
},
created_at?: string;
}
export type PartialNewOffer = Omit<Offer, 'redemption_count'>;

View file

@ -11,6 +11,15 @@ import {useGlobalData} from '../../../providers/GlobalDataProvider';
import {useHandleError} from '@tryghost/admin-x-framework/hooks';
import {useRouting} from '@tryghost/admin-x-framework/routing';
function formatTimestamp(timestamp: string): string {
const date = new Date(timestamp);
return date.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
}
const Sidebar: React.FC<{
clearError: (field: string) => void,
errors: ErrorMessages,
@ -88,7 +97,7 @@ const Sidebar: React.FC<{
<div className='flex flex-col gap-5 rounded-md border border-grey-300 p-4 pb-3.5'>
<div className='flex flex-col gap-1.5'>
<span className='text-xs font-semibold leading-none text-grey-700'>Created at</span>
<span>June 14, 2023</span>
<span>{formatTimestamp(offer?.created_at ? offer.created_at : '')}</span>
</div>
<div className='flex flex-col gap-1.5'>
<span className='text-xs font-semibold leading-none text-grey-700'>Total redemptions</span>