diff --git a/ghost/admin/app/components/modal-stats-all.js b/ghost/admin/app/components/modal-stats-all.js index cf05ed3738..3a380fc2ae 100644 --- a/ghost/admin/app/components/modal-stats-all.js +++ b/ghost/admin/app/components/modal-stats-all.js @@ -4,10 +4,10 @@ import Component from '@glimmer/component'; import React from 'react'; import moment from 'moment-timezone'; import {BarList, useQuery} from '@tinybirdco/charts'; +import {barListColor} from '../utils/stats'; import {formatNumber} from 'ghost-admin/helpers/format-number'; import {getCountryFlag} from 'ghost-admin/utils/stats'; import {inject} from 'ghost-admin/decorators/inject'; -import {statsStaticColors} from 'ghost-admin/utils/stats'; export default class AllStatsModal extends Component { @inject config; @@ -99,7 +99,7 @@ export default class AllStatsModal extends Component { indexConfig={{ label: {labelText}, renderBarContent: ({label}) => ( - {(type === 'top-locations') && getCountryFlag(label)} {label || unknownOption} + {(type === 'top-locations') && getCountryFlag(label)} {type === 'top-sources' && ()} {label || unknownOption} ) }} categories={['hits']} @@ -109,7 +109,7 @@ export default class AllStatsModal extends Component { renderValue: ({value}) => {formatNumber(value)} } }} - colorPalette={[statsStaticColors[4]]} + colorPalette={[barListColor]} /> ); }; diff --git a/ghost/admin/app/components/stats/charts/kpis.js b/ghost/admin/app/components/stats/charts/kpis.js index 10799cde49..66ec2f39e5 100644 --- a/ghost/admin/app/components/stats/charts/kpis.js +++ b/ghost/admin/app/components/stats/charts/kpis.js @@ -47,41 +47,44 @@ export default class KpisComponent extends Component { }); // Create an array with every second date value - const dateLabels = []; - let currentDate = startDate.clone(); - let skipDays; - switch (chartRange) { - case 1: - skipDays = 0; // Show all hours for 1 day - break; - case 7: - skipDays = 0; // Skip every other day for 7 days - break; - case (30 + 1): - skipDays = 2; // Skip every 3rd day for 30 and 90 days - break; - case (90 + 1): - skipDays = 5; // Skip every 3rd day for 30 and 90 days - break; - case (365 + 1): - case (12 * (30 + 1)): - skipDays = 30; // Skip every 7th day for 1 year - break; - case 1000: - skipDays = 29; // Skip every 30th day for all time - break; - default: - skipDays = 1; // Default to skipping every other day - } + const dateLabels = [ + startDate.format('YYYY-MM-DD'), + endDate.format('YYYY-MM-DD') + ]; + // let currentDate = startDate.clone(); + // let skipDays; + // switch (chartRange) { + // case 1: + // skipDays = 0; // Show all hours for 1 day + // break; + // case 7: + // skipDays = 0; // Skip every other day for 7 days + // break; + // case (30 + 1): + // skipDays = 2; // Skip every 3rd day for 30 and 90 days + // break; + // case (90 + 1): + // skipDays = 5; // Skip every 3rd day for 30 and 90 days + // break; + // case (365 + 1): + // case (12 * (30 + 1)): + // skipDays = 30; // Skip every 7th day for 1 year + // break; + // case 1000: + // skipDays = 29; // Skip every 30th day for all time + // break; + // default: + // skipDays = 1; // Default to skipping every other day + // } - let dayCounter = 0; - while (currentDate.isSameOrBefore(endDate)) { - if (dayCounter % (skipDays + 1) === 0) { - dateLabels.push(currentDate.format('YYYY-MM-DD')); - } - currentDate.add(1, 'days'); - dayCounter = dayCounter + 1; - } + // let dayCounter = 0; + // while (currentDate.isSameOrBefore(endDate)) { + // if (dayCounter % (skipDays + 1) === 0) { + // dateLabels.push(currentDate.format('YYYY-MM-DD')); + // } + // currentDate.add(1, 'days'); + // dayCounter = dayCounter + 1; + // } return ( [ diff --git a/ghost/admin/app/components/stats/charts/top-locations.js b/ghost/admin/app/components/stats/charts/top-locations.js index 7db78bb96e..78c47c9671 100644 --- a/ghost/admin/app/components/stats/charts/top-locations.js +++ b/ghost/admin/app/components/stats/charts/top-locations.js @@ -6,8 +6,9 @@ import React from 'react'; import moment from 'moment-timezone'; import {BarList, useQuery} from '@tinybirdco/charts'; import {action} from '@ember/object'; +import {barListColor} from '../../../utils/stats'; import {formatNumber} from '../../../helpers/format-number'; -import {getCountryFlag, statsStaticColors} from 'ghost-admin/utils/stats'; +import {getCountryFlag} from 'ghost-admin/utils/stats'; import {inject} from 'ghost-admin/decorators/inject'; import {inject as service} from '@ember/service'; @@ -74,7 +75,7 @@ export default class TopLocations extends Component { renderValue: ({value}) => {formatNumber(value)} } }} - colorPalette={[statsStaticColors[4]]} + colorPalette={[barListColor]} /> ); }; diff --git a/ghost/admin/app/components/stats/charts/top-pages.js b/ghost/admin/app/components/stats/charts/top-pages.js index 61a5314318..227fa6fe97 100644 --- a/ghost/admin/app/components/stats/charts/top-pages.js +++ b/ghost/admin/app/components/stats/charts/top-pages.js @@ -7,10 +7,10 @@ import moment from 'moment-timezone'; import {BarList, useQuery} from '@tinybirdco/charts'; import {CONTENT_OPTIONS} from 'ghost-admin/utils/stats'; import {action} from '@ember/object'; +import {barListColor} from '../../../utils/stats'; import {formatNumber} from '../../../helpers/format-number'; import {inject} from 'ghost-admin/decorators/inject'; import {inject as service} from '@ember/service'; -import {statsStaticColors} from 'ghost-admin/utils/stats'; import {tracked} from '@glimmer/tracking'; export default class TopPages extends Component { @@ -85,7 +85,7 @@ export default class TopPages extends Component { renderValue: ({value}) => {formatNumber(value)} } }} - colorPalette={[statsStaticColors[4]]} + colorPalette={[barListColor]} /> ); }; diff --git a/ghost/admin/app/components/stats/charts/top-sources.js b/ghost/admin/app/components/stats/charts/top-sources.js index 86fdeaa71e..e986af1298 100644 --- a/ghost/admin/app/components/stats/charts/top-sources.js +++ b/ghost/admin/app/components/stats/charts/top-sources.js @@ -7,10 +7,10 @@ import moment from 'moment-timezone'; import {BarList, useQuery} from '@tinybirdco/charts'; import {CAMPAIGN_OPTIONS} from 'ghost-admin/utils/stats'; import {action} from '@ember/object'; +import {barListColor} from '../../../utils/stats'; import {formatNumber} from '../../../helpers/format-number'; import {inject} from 'ghost-admin/decorators/inject'; import {inject as service} from '@ember/service'; -import {statsStaticColors} from 'ghost-admin/utils/stats'; import {tracked} from '@glimmer/tracking'; export default class TopPages extends Component { @@ -74,7 +74,7 @@ export default class TopPages extends Component { indexConfig={{ label: Source, renderBarContent: ({label}) => ( - {label || 'Direct'} + {label || 'Direct'} ) }} categories={['hits']} @@ -84,8 +84,7 @@ export default class TopPages extends Component { renderValue: ({value}) => {formatNumber(value)} } }} - colorPalette={[statsStaticColors[4]]} - // height="300px" + colorPalette={[barListColor]} /> ); }; diff --git a/ghost/admin/app/components/stats/kpis-overview.hbs b/ghost/admin/app/components/stats/kpis-overview.hbs index 0fe71a4cd8..d96a1c7f2d 100644 --- a/ghost/admin/app/components/stats/kpis-overview.hbs +++ b/ghost/admin/app/components/stats/kpis-overview.hbs @@ -1,4 +1,4 @@ -
+
- \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/ghost/admin/app/styles/layouts/stats.css b/ghost/admin/app/styles/layouts/stats.css index 46f4232619..e0e82be983 100644 --- a/ghost/admin/app/styles/layouts/stats.css +++ b/ghost/admin/app/styles/layouts/stats.css @@ -34,6 +34,10 @@ transition: all ease-in-out 0.3s; } +.gh-stats-container.no-gap { + gap: 0; +} + .gh-stats-container > .gh-stats-metric-label, .gh-stats-metric-header { margin-bottom: 12px; @@ -232,4 +236,19 @@ background: linear-gradient(180deg, rgba(255, 255, 255, 0.0) 0%, #FFF 100%); height: 60px; z-index: 9999; +} + +.gh-stats-kpis-chart-container { + margin-top: -20px; +} + +.gh-stats-domain { + display: flex; + align-items: center; + gap: 6px; +} + +.gh-stats-favicon { + width: 16px; + height: 16px; } \ No newline at end of file diff --git a/ghost/admin/app/templates/stats.hbs b/ghost/admin/app/templates/stats.hbs index 8071cdeb8f..96e513308d 100644 --- a/ghost/admin/app/templates/stats.hbs +++ b/ghost/admin/app/templates/stats.hbs @@ -25,7 +25,7 @@
-
+
diff --git a/ghost/admin/app/utils/stats.js b/ghost/admin/app/utils/stats.js index e77c6ca145..1e77f2913d 100644 --- a/ghost/admin/app/utils/stats.js +++ b/ghost/admin/app/utils/stats.js @@ -106,6 +106,8 @@ export function generateMonochromePalette(baseColor, count = 10) { return palette; } +export const barListColor = '#F1F3F4'; + export const statsStaticColors = [ '#8E42FF', '#B07BFF', '#C7A0FF', '#DDC6FF', '#EBDDFF', '#F7EDFF' ];