Slop/sloppy fixes #1
No files matched your search
@@ -4,6 +4,7 @@ import React from "react";
|
|||||||
|
|
||||||
import { OrderStatsDocument, SchemaOrderStatsByTime } from "../../types";
|
import { OrderStatsDocument, SchemaOrderStatsByTime } from "../../types";
|
||||||
import { StatsView } from "./StatsView";
|
import { StatsView } from "./StatsView";
|
||||||
|
import { chartTheme } from "./chartTheme";
|
||||||
|
|
||||||
const days = { 1: "Mandag", 2: "Tirsdag", 3: "Onsdag", 4: "Torsdag", 5: "Fredag", 6: "Lørdag", 7: "Søndag" };
|
const days = { 1: "Mandag", 2: "Tirsdag", 3: "Onsdag", 4: "Torsdag", 5: "Fredag", 6: "Lørdag", 7: "Søndag" };
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ const months = {
|
|||||||
const OrderBar = ({ data }: { data: BarDatum[] }) => (
|
const OrderBar = ({ data }: { data: BarDatum[] }) => (
|
||||||
<Bar
|
<Bar
|
||||||
data={data}
|
data={data}
|
||||||
|
theme={chartTheme}
|
||||||
margin={{ left: 60, bottom: 40 }}
|
margin={{ left: 60, bottom: 40 }}
|
||||||
width={1200}
|
width={1200}
|
||||||
height={400}
|
height={400}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import React from "react";
|
|||||||
import { AllProductStatsDocument } from "../../types";
|
import { AllProductStatsDocument } from "../../types";
|
||||||
import styles from "./Stats.module.css";
|
import styles from "./Stats.module.css";
|
||||||
import { StatsView } from "./StatsView";
|
import { StatsView } from "./StatsView";
|
||||||
|
import { chartTheme } from "./chartTheme";
|
||||||
|
|
||||||
type UserCount = {
|
type UserCount = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -31,6 +32,9 @@ const ProductStats = () => {
|
|||||||
}))}
|
}))}
|
||||||
width={400}
|
width={400}
|
||||||
height={300}
|
height={300}
|
||||||
|
theme={chartTheme}
|
||||||
|
arcLabelsTextColor="#17121a"
|
||||||
|
arcLabelsSkipAngle={8}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import React from "react";
|
|||||||
|
|
||||||
import { ProductStatsDocument } from "../../types";
|
import { ProductStatsDocument } from "../../types";
|
||||||
import { StatsView } from "./StatsView";
|
import { StatsView } from "./StatsView";
|
||||||
|
import { chartTheme, chartTooltipStyle } from "./chartTheme";
|
||||||
|
|
||||||
const Stats = () => {
|
const Stats = () => {
|
||||||
const { data, loading } = useQuery(ProductStatsDocument);
|
const { data, loading } = useQuery(ProductStatsDocument);
|
||||||
@@ -21,6 +22,7 @@ const Stats = () => {
|
|||||||
<h2>Kjøp over tid</h2>
|
<h2>Kjøp over tid</h2>
|
||||||
<Line
|
<Line
|
||||||
data={series}
|
data={series}
|
||||||
|
theme={chartTheme}
|
||||||
width={1000}
|
width={1000}
|
||||||
height={400}
|
height={400}
|
||||||
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
|
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
|
||||||
@@ -47,13 +49,7 @@ const Stats = () => {
|
|||||||
useMesh
|
useMesh
|
||||||
pointLabelYOffset={0}
|
pointLabelYOffset={0}
|
||||||
tooltip={({ point }) => (
|
tooltip={({ point }) => (
|
||||||
<div
|
<div style={chartTooltipStyle}>
|
||||||
style={{
|
|
||||||
background: "white",
|
|
||||||
padding: "9px 12px",
|
|
||||||
border: "1px solid #ccc",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<strong>{point.data.xFormatted}</strong>
|
<strong>{point.data.xFormatted}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
export const chartTheme = {
|
||||||
|
background: "transparent",
|
||||||
|
text: {
|
||||||
|
fill: "#f7effa",
|
||||||
|
fontFamily: '"IBM Plex Mono", monospace',
|
||||||
|
fontSize: 13,
|
||||||
|
textShadow: "none",
|
||||||
|
},
|
||||||
|
axis: {
|
||||||
|
domain: {
|
||||||
|
line: { stroke: "#b9a3c5", strokeWidth: 1 },
|
||||||
|
},
|
||||||
|
ticks: {
|
||||||
|
line: { stroke: "#b9a3c5", strokeWidth: 1 },
|
||||||
|
text: { fill: "#f7effa", fontSize: 12, textShadow: "none" },
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
text: { fill: "#f7effa", fontSize: 13, textShadow: "none" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
line: { stroke: "rgba(221, 81, 127, 0.24)", strokeWidth: 1 },
|
||||||
|
},
|
||||||
|
legends: {
|
||||||
|
text: { fill: "#f7effa", fontSize: 12, textShadow: "none" },
|
||||||
|
title: {
|
||||||
|
text: { fill: "#f7effa", fontSize: 13, textShadow: "none" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
labels: {
|
||||||
|
text: {
|
||||||
|
fill: "#ffffff",
|
||||||
|
fontSize: 13,
|
||||||
|
textShadow: "none",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
container: {
|
||||||
|
background: "#2b1733",
|
||||||
|
color: "#ffffff",
|
||||||
|
fontFamily: '"IBM Plex Mono", monospace',
|
||||||
|
fontSize: 13,
|
||||||
|
border: "1px solid #dd517f",
|
||||||
|
borderRadius: 4,
|
||||||
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.45)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const chartTooltipStyle = {
|
||||||
|
background: "#2b1733",
|
||||||
|
color: "#ffffff",
|
||||||
|
padding: "9px 12px",
|
||||||
|
border: "1px solid #dd517f",
|
||||||
|
borderRadius: 4,
|
||||||
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.45)",
|
||||||
|
fontFamily: '"IBM Plex Mono", monospace',
|
||||||
|
fontSize: 13,
|
||||||
|
textShadow: "none",
|
||||||
|
};
|
||||||
@@ -6,6 +6,7 @@ import { useParams } from "react-router-dom";
|
|||||||
import { GQLError } from "../../components/GQLError";
|
import { GQLError } from "../../components/GQLError";
|
||||||
import { SchemaUser as User, UserDetailDocument, SchemaUserProfile as UserProfile } from "../../types";
|
import { SchemaUser as User, UserDetailDocument, SchemaUserProfile as UserProfile } from "../../types";
|
||||||
import { formatMonth, formatTime } from "../../utils/time";
|
import { formatMonth, formatTime } from "../../utils/time";
|
||||||
|
import { chartTheme, chartTooltipStyle } from "../stats/chartTheme";
|
||||||
import styles from "./UserDetail.module.css";
|
import styles from "./UserDetail.module.css";
|
||||||
|
|
||||||
const UserDetail = () => {
|
const UserDetail = () => {
|
||||||
@@ -62,6 +63,7 @@ const UserDetail = () => {
|
|||||||
<h2>Kjøp over tid</h2>
|
<h2>Kjøp over tid</h2>
|
||||||
<Line
|
<Line
|
||||||
data={series}
|
data={series}
|
||||||
|
theme={chartTheme}
|
||||||
width={1000}
|
width={1000}
|
||||||
height={400}
|
height={400}
|
||||||
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
|
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
|
||||||
@@ -88,13 +90,7 @@ const UserDetail = () => {
|
|||||||
useMesh
|
useMesh
|
||||||
pointLabelYOffset={0}
|
pointLabelYOffset={0}
|
||||||
tooltip={({ point }) => (
|
tooltip={({ point }) => (
|
||||||
<div
|
<div style={chartTooltipStyle}>
|
||||||
style={{
|
|
||||||
background: "white",
|
|
||||||
padding: "9px 12px",
|
|
||||||
border: "1px solid #ccc",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<strong>{point.data.xFormatted}</strong>
|
<strong>{point.data.xFormatted}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user