Skip to content

Commit

Permalink
Merge branch 'develop' into fix/multistep-modal-closing
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris authored Aug 28, 2024
2 parents 002b212 + 9ef09d8 commit 320a8dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
import { Skeleton } from '@rocket.chat/fuselage';
import type { TranslationKey } from '@rocket.chat/ui-contexts';
import { useTranslation } from '@rocket.chat/ui-contexts';
import React, { useEffect, useState } from 'react';

import { AsyncStatePhase } from '../../../../hooks/useAsyncState';
import CounterItem from './CounterItem';
import CounterRow from './CounterRow';

type DataType = {
title: TranslationKey;
value: number;
}[];

type Totalizers = {
totalizers: DataType;
};

type CounterContainerProps = {
data: Totalizers;
state: AsyncStatePhase;
initialData: DataType;
};

const CounterContainer = ({ data, state, initialData, ...props }: CounterContainerProps) => {
const CounterContainer = ({ data, state, initialData, ...props }) => {
const t = useTranslation();

const [displayData, setDisplayData] = useState<DataType>(initialData);
const [displayData, setDisplayData] = useState(initialData);

const { totalizers } = data || { totalizers: initialData };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export const Default: ComponentStory<typeof CounterContainer> = (args) => <Count
Default.storyName = 'CounterContainer';
Default.args = {
initialData: [
{ title: 'Total_conversations', value: 10 },
{ title: 'Open_conversations', value: 10 },
{ title: 'Total_messages', value: 10 },
{ title: 'Total_visitors', value: 0 },
{ title: 'total conversations', value: 10 },
{ title: 'open conversations', value: 10 },
{ title: 'total messages', value: 10 },
{ title: 'total visitors' },
],
data: { totalizers: [] },
data: [],
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { Box, Divider } from '@rocket.chat/fuselage';
import type { ComponentProps, ReactNode } from 'react';
import React, { Fragment } from 'react';
import flattenChildren from 'react-keyed-flatten-children';

type CounterRowProps = {
children: ReactNode[];
} & ComponentProps<typeof Box>;

const CounterRow = ({ children, ...props }: CounterRowProps) => (
const CounterRow = ({ children, ...props }) => (
<Box pb={28} pi={20} display='flex' flexDirection='row' justifyContent='space-around' alignItems='center' flexGrow={1} {...props}>
{children &&
flattenChildren(children).reduce((acc: ReactNode[], child, i) => {
flattenChildren(children).reduce((acc, child, i) => {
acc =
children.length - 1 !== i
? [
Expand Down

0 comments on commit 320a8dd

Please sign in to comment.