Skip to content

Commit

Permalink
feat: metric detail and home update (#266)
Browse files Browse the repository at this point in the history
Signed-off-by: laixingyou <[email protected]>
  • Loading branch information
coder-sett authored Nov 21, 2023
1 parent df299ed commit 0e1295c
Show file tree
Hide file tree
Showing 32 changed files with 894 additions and 1,546 deletions.
16 changes: 8 additions & 8 deletions apps/web/src/common/components/Header/MobileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ const MobileHeader: React.FC<PropsWithChildren> = ({ children }) => {
icon: null,
},
{
title: t('common:header.explore'),
title: t('common:header.docs'),
href: '/docs/dimensions-define',
icon: null,
},
{
title: t('common:header.projects'),
href: '/explore',
icon: null,
},
{
title: t('common:header.metrics_models'),
href: '/docs/dimensions-define',
title: t('common:header.lab'),
href: '/lab',
icon: null,
},
{
Expand All @@ -53,11 +58,6 @@ const MobileHeader: React.FC<PropsWithChildren> = ({ children }) => {
href: '/blog',
icon: null,
},
{
title: t('common:header.lab'),
href: '/lab',
icon: null,
},
{
title: t('common:header.about'),
href: '/about',
Expand Down
30 changes: 15 additions & 15 deletions apps/web/src/common/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,30 @@ const Header: React.FC<{
<Logo color="white" />
</Link>

<Link
href="/explore"
className={'mx-6 px-2.5 font-medium text-white 2xl:mx-2'}
>
{t('common:header.explore')}
</Link>

<LinkX href="/docs/dimensions-define" legacyBehavior>
<a
className={
'mx-6 flex-shrink-0 px-2.5 font-medium text-white 2xl:mx-2'
}
>
{t('common:header.metrics_models')}
{t('common:header.docs')}
</a>
</LinkX>

<Link
href="/explore"
className={'mx-6 px-2.5 font-medium text-white 2xl:mx-2'}
>
{t('common:header.projects')}
</Link>

<Link
href="/lab"
className={'mx-6 px-2.5 font-medium text-white 2xl:mx-2'}
>
{t('common:header.lab')}
</Link>

<CommunityDropdown />

<LinkX href="/blog" legacyBehavior>
Expand All @@ -59,13 +66,6 @@ const Header: React.FC<{
</a>
</LinkX>

<Link
href="/lab"
className={'mx-6 px-2.5 font-medium text-white 2xl:mx-2'}
>
{t('common:header.lab')}
</Link>

<Link
href="/about"
className={'mx-6 px-2.5 font-medium text-white 2xl:mx-2'}
Expand Down
128 changes: 128 additions & 0 deletions apps/web/src/common/options/gradientRamp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
export const gradientRamp = [
[
'#4a90e2',
'#1d2c4e',
'#29467f',
'#2d51a0',
'#3063c5',
'#3978d7',
'#4a90e2',
'#70b1ea',
'#9ecdf2',
'#c6e0f7',
'#dfedfa',
'#f1f7fd',
],
[
'#9858f4',
'#320962',
'#4e1e85',
'#5e23a6',
'#6d25cb',
'#8136e7',
'#9858f4',
'#a872f9',
'#d1b5fd',
'#e5d6fe',
'#f1e8ff',
'#f9f5ff',
],
[
'#6bbc26',
'#142909',
'#2f4e19',
'#335c1a ',
'#3f7219',
'#50961a',
'#6bbc26',
'#89d744',
'#a7e56d',
'#ccf1a5',
'#e5f8cf',
'#f3fce9',
],
[
'#f97316',
'#431407',
'#7c2d12',
'#9a3412',
'#c2410c',
'#ea580c',
'#f97316',
'#fb923c',
'#fdba74',
'#fed7aa',
'#ffedd5',
'#fff7ed',
],
[
'#14b8a6',
'#042f2e',
'#134e4a',
'#115e59',
'#0f766e',
'#0d9488',
'#14b8a6',
'#2dd4bf',
'#5eead4',
'#99f6e4',
'#ccfbf1',
'#f0fdfa',
],
[
'#ec4899',
'#500725',
'#831843',
'#9c164d',
'#be185e',
'#db2879',
'#ec4899',
'#f472b5',
'#f8a8d3',
'#fccfea',
'#fbe7f3',
'#fcf2f8',
],
[
'#e9b308',
'#432007',
'#714013',
'#844d0e',
'#a06207',
'#cb8a03',
'#e9b308',
'#f9cc15',
'#fce146',
'#fff08a',
'#fef9c4',
'#fefce8',
],
[
'#ee4444',
'#450a0a',
'#7f1d1c',
'#9b1b1b',
'#b91b1c',
'#dc2626',
'#ee4444',
'#f87271',
'#fca5a5',
'#fecaca',
'#fde2e2',
'#fef2f2',
],
[
'#8c90a1',
'#2f3135',
'#52555d',
'#626571',
'#787a8c',
'#a1a5b3',
'#8c8fa2',
'#b6b8c5',
'#d2d6db',
'#dfe3e6',
'#edeff3',
'#f5f7f9',
],
];
1 change: 1 addition & 0 deletions apps/web/src/common/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './color';
export * from './echartOpt';
export * from './palette';
export * from './series';
export * from './gradientRamp';
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ReactEChartsProps {
loading?: boolean;
theme?: 'light' | 'dark';
containerRef?: React.RefObject<HTMLElement>;
legendselectchanged?: any;
filterData?: any;
}

const MetricChart: React.FC<ReactEChartsProps> = ({
Expand All @@ -23,7 +23,7 @@ const MetricChart: React.FC<ReactEChartsProps> = ({
loading,
theme,
containerRef,
legendselectchanged,
filterData,
}) => {
const inView = useInViewportDebounce(containerRef);
const chartRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -54,18 +54,17 @@ const MetricChart: React.FC<ReactEChartsProps> = ({
if (inView && chartRef.current !== null) {
const chart = getInstanceByDom(chartRef.current)!;
chart.setOption(option, settings);
if (legendselectchanged) {
const chart = getInstanceByDom(chartRef.current)!;
if (filterData) {
chart.on('legendselectchanged', function (params: any) {
let selected = params.selected!;
let options = chart.getOption();
let selectedList = Object.keys(selected).filter(
const selected = params.selected!;
const options = chart.getOption();
const selectedList = Object.keys(selected).filter(
(item) => selected[item]
);
options.series[1].data = legendselectchanged.filter((item) =>
selectedList.includes(item.org)
options.series[1].data = filterData.filter((item) =>
selectedList.includes(item.parentName)
);
this.setOption(options);
chart.setOption(options);
});
}
}
Expand Down
Loading

2 comments on commit 0e1295c

@vercel
Copy link

@vercel vercel bot commented on 0e1295c Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 0e1295c Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.