ui fix
This commit is contained in:
parent
6c401a34c4
commit
b39e3f327c
@ -706,7 +706,11 @@ if (color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function abbreviateNumber(number, addDollarSign = false) {
|
export function abbreviateNumber(
|
||||||
|
number,
|
||||||
|
addDollarSign = false,
|
||||||
|
stripTrailingZeros = true
|
||||||
|
) {
|
||||||
// Check if number is null or undefined, return "-" if true
|
// Check if number is null or undefined, return "-" if true
|
||||||
if (number == null) {
|
if (number == null) {
|
||||||
return "-";
|
return "-";
|
||||||
@ -745,10 +749,13 @@ export function abbreviateNumber(number, addDollarSign = false) {
|
|||||||
abbreviation = abbreviation.toFixed(2);
|
abbreviation = abbreviation.toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
abbreviation = parseFloat(abbreviation).toLocaleString("en-US", {
|
// When stripTrailingZeros is true, we set the minimumFractionDigits to 0
|
||||||
|
const localeOptions = {
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: stripTrailingZeros ? 0 : 2,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
abbreviation = parseFloat(abbreviation).toLocaleString("en-US", localeOptions);
|
||||||
|
|
||||||
const formattedNumber = abbreviation + suffixes[index];
|
const formattedNumber = abbreviation + suffixes[index];
|
||||||
|
|
||||||
@ -768,6 +775,7 @@ export function abbreviateNumber(number, addDollarSign = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function formatDate(dateStr) {
|
export function formatDate(dateStr) {
|
||||||
try {
|
try {
|
||||||
// Parse the input date string in Berlin timezone
|
// Parse the input date string in Berlin timezone
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
import { abbreviateNumber, removeCompanyStrings } from "$lib/utils";
|
import { abbreviateNumber, removeCompanyStrings } from "$lib/utils";
|
||||||
import SEO from "$lib/components/SEO.svelte";
|
import SEO from "$lib/components/SEO.svelte";
|
||||||
|
|
||||||
//import * as XLSX from 'xlsx';
|
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
import highcharts from "$lib/highcharts.ts";
|
import highcharts from "$lib/highcharts.ts";
|
||||||
|
|
||||||
@ -12,7 +11,6 @@
|
|||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let config = null;
|
let config = null;
|
||||||
let chartInstance;
|
|
||||||
|
|
||||||
let rawData = data?.getHistoricalRevenue || {};
|
let rawData = data?.getHistoricalRevenue || {};
|
||||||
let tableList = [];
|
let tableList = [];
|
||||||
@ -66,7 +64,7 @@
|
|||||||
config = plotData();
|
config = plotData();
|
||||||
try {
|
try {
|
||||||
config.yAxis.labels.formatter = function () {
|
config.yAxis.labels.formatter = function () {
|
||||||
return abbreviateNumber(this.value);
|
return abbreviateNumber(this?.value);
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@ -96,14 +94,21 @@
|
|||||||
type: "column",
|
type: "column",
|
||||||
backgroundColor: "#09090B",
|
backgroundColor: "#09090B",
|
||||||
plotBackgroundColor: "#09090B",
|
plotBackgroundColor: "#09090B",
|
||||||
|
height: 360, // Set the maximum height for the chart
|
||||||
|
animation: false,
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
text:
|
text:
|
||||||
timeIdx === 0
|
timeIdx === 0
|
||||||
? `${removeCompanyStrings($displayCompanyName)} Revenue - Annual`
|
? `<h3 class="mt-3 mb-1">${removeCompanyStrings($displayCompanyName)} Revenue - Annual</h3>`
|
||||||
: `${removeCompanyStrings($displayCompanyName)} Revenue - Quarterly`,
|
: `<h3 class="mt-3 mb-1">${removeCompanyStrings($displayCompanyName)} Revenue - Quarterly</h3>`,
|
||||||
style: { color: "white" },
|
style: {
|
||||||
|
color: "white",
|
||||||
|
// Using inline CSS for margin-top and margin-bottom
|
||||||
|
},
|
||||||
|
useHTML: true, // Enable HTML to apply custom class styling
|
||||||
},
|
},
|
||||||
|
|
||||||
xAxis: {
|
xAxis: {
|
||||||
categories: dates,
|
categories: dates,
|
||||||
gridLineWidth: 0,
|
gridLineWidth: 0,
|
||||||
@ -205,7 +210,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-6 mt-3"
|
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-4 mt-3"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="bg-gray-800/30 rounded-lg p-4 sm:hover:bg-gray-800/40 transition-colors"
|
class="bg-gray-800/30 rounded-lg p-4 sm:hover:bg-gray-800/40 transition-colors"
|
||||||
@ -301,7 +306,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="mt-10 flex flex-col sm:flex-row items-start sm:items-center w-full justify-between"
|
class=" flex flex-col sm:flex-row items-start sm:items-center w-full justify-between"
|
||||||
>
|
>
|
||||||
<h2 class="text-xl sm:text-2xl text-white font-bold">
|
<h2 class="text-xl sm:text-2xl text-white font-bold">
|
||||||
Revenue Chart
|
Revenue Chart
|
||||||
@ -340,12 +345,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chart mt-5" use:highcharts={config}></div>
|
<div
|
||||||
|
class="chart mt-5 sm:mt-0 border border-gray-800 rounded"
|
||||||
|
use:highcharts={config}
|
||||||
|
></div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="mt-10 flex flex-col sm:flex-row items-start sm:items-center w-full justify-between"
|
class="mt-5 flex flex-col sm:flex-row items-start sm:items-center w-full justify-between sm:border-y border-gray-800 sm:pt-2 sm:pb-2"
|
||||||
>
|
>
|
||||||
<h3 class="text-xl sm:text-2xl text-white font-bold">
|
<h3
|
||||||
|
class="text-xl sm:text-2xl text-white font-bold mb-2 sm:mb-0"
|
||||||
|
>
|
||||||
Revenue History
|
Revenue History
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
@ -353,7 +363,7 @@
|
|||||||
class="inline-flex justify-center w-full rounded-md sm:w-auto sm:ml-auto"
|
class="inline-flex justify-center w-full rounded-md sm:w-auto sm:ml-auto"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="bg-secondary w-full min-w-24 sm:w-fit relative flex flex-wrap items-center justify-center rounded-md p-1 mt-4"
|
class="bg-secondary w-full min-w-24 sm:w-fit relative flex flex-wrap items-center justify-center rounded-md p-1"
|
||||||
>
|
>
|
||||||
{#each tabs as item, i}
|
{#each tabs as item, i}
|
||||||
{#if data?.user?.tier !== "Pro" && i > 0}
|
{#if data?.user?.tier !== "Pro" && i > 0}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user