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:
parent
3a78cf48c9
commit
17f8844134
2 changed files with 12 additions and 2 deletions
|
@ -19,7 +19,8 @@ export type Offer = {
|
|||
tier: {
|
||||
id: string;
|
||||
name?: string;
|
||||
}
|
||||
},
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
export type PartialNewOffer = Omit<Offer, 'redemption_count'>;
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue