Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

1.7 KB
Raw Blame
<script setup lang="ts">
import { computed } from 'vue';

import {
    Tooltip,
    TooltipContent,
    TooltipProvider,
    TooltipTrigger,
} from '@/components/ui/tooltip';
import date from '@/date';
import type { DateRange } from '@/types/analytics';

const props = defineProps<{
    range: DateRange;
    /** The period the changes are measured against. */
    previous: DateRange;
}>();

const previousLabel = computed(() =>
    date.formatComparedRange(props.previous, props.range),
);
</script>

<template>
    <span class="inline-flex flex-wrap items-center gap-x-2 gap-y-1">
        <span data-testid="analytics-range-current">{{
            date.formatDayMonthYearRange(range)
        }}</span>
        <TooltipProvider :delay-duration="200">
            <Tooltip>
                <TooltipTrigger as-child>
                    <span
                        tabindex="0"
                        class="inline-flex items-center rounded-md bg-muted px-1.5 py-0.5 text-[11px] leading-4 font-medium whitespace-nowrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"
                        data-testid="analytics-range-previous"
                    >
                        {{ $t('analytics.ranges.versus', { range: previousLabel }) }}
                    </span>
                </TooltipTrigger>
                <TooltipContent class="max-w-64">
                    {{
                        $t('analytics.ranges.versus_hint', {
                            range: date.formatDayMonthYearRange(previous),
                        })
                    }}
                </TooltipContent>
            </Tooltip>
        </TooltipProvider>
    </span>
</template>