feat: PR review changes

This commit is contained in:
Pranshu Chittora 2022-03-16 16:05:21 +05:30
parent 9404768f9d
commit 7f3d9e2e35
No known key found for this signature in database
GPG Key ID: 3A9E57A016CC0626
5 changed files with 27 additions and 33 deletions

View File

@ -3,10 +3,7 @@ import { TextProps } from 'antd/lib/typography/Text';
import { TitleProps } from 'antd/lib/typography/Title';
import React from 'react';
import styled, {
css,
DefaultTheme,
FlattenSimpleInterpolation,
ThemedCssFunction,
} from 'styled-components';
import { IStyledClass } from './types';
@ -14,52 +11,50 @@ import { IStyledClass } from './types';
const styledClass = (props: IStyledClass): FlattenSimpleInterpolation =>
props.styledclass;
interface IStyledCol extends AntD.ColProps, IStyledClass {}
const StyledCol = styled(AntD.Col)<IStyledCol>`
type TStyledCol = AntD.ColProps & IStyledClass;
const StyledCol = styled(AntD.Col)<TStyledCol>`
${styledClass}
`;
interface IStyledRow extends AntD.RowProps, IStyledClass {}
const StyledRow = styled(AntD.Row)<IStyledRow>`
type TStyledRow = AntD.RowProps & IStyledClass;
const StyledRow = styled(AntD.Row)<TStyledRow>`
${styledClass}
`;
interface IStyledDivider extends AntD.DividerProps, IStyledClass {}
const StyledDivider = styled(AntD.Divider)<IStyledDivider>`
type TStyledDivider = AntD.DividerProps & IStyledClass;
const StyledDivider = styled(AntD.Divider)<TStyledDivider>`
${styledClass}
`;
interface IStyledSpace extends AntD.SpaceProps, IStyledClass {}
const StyledSpace = styled(AntD.Space)<IStyledSpace>`
type TStyledSpace = AntD.SpaceProps & IStyledClass;
const StyledSpace = styled(AntD.Space)<TStyledSpace>`
${styledClass}
`;
interface IStyledTabs extends AntD.TabsProps, IStyledClass {}
const StyledTabs = styled(AntD.Divider)<IStyledTabs>`
type TStyledTabs = AntD.TabsProps & IStyledClass;
const StyledTabs = styled(AntD.Divider)<TStyledTabs>`
${styledClass}
`;
interface IStyledButton extends AntD.ButtonProps, IStyledClass {}
const StyledButton = styled(AntD.Button)<IStyledButton>`
type TStyledButton = AntD.ButtonProps & IStyledClass;
const StyledButton = styled(AntD.Button)<TStyledButton>`
${styledClass}
`;
const { Text } = AntD.Typography;
interface IStyledTypographyText extends TextProps, IStyledClass {}
const StyledTypographyText = styled(Text)<IStyledTypographyText>`
type TStyledTypographyText = TextProps & IStyledClass;
const StyledTypographyText = styled(Text)<TStyledTypographyText>`
${styledClass}
`;
const { Title } = AntD.Typography;
interface IStyledTypographyTitle extends TitleProps, IStyledClass {}
const StyledTypographyTitle = styled(Title)<IStyledTypographyTitle>`
type TStyledTypographyTitle = TitleProps & IStyledClass;
const StyledTypographyTitle = styled(Title)<TStyledTypographyTitle>`
${styledClass}
`;
interface IStyledDiv
extends React.HTMLAttributes<HTMLDivElement>,
IStyledClass {}
const StyledDiv = styled.div<IStyledDiv>`
type TStyledDiv = React.HTMLAttributes<HTMLDivElement> & IStyledClass;
const StyledDiv = styled.div<TStyledDiv>`
${styledClass}
`;

View File

@ -1,6 +1,6 @@
import { css, FlattenSimpleInterpolation } from 'styled-components';
const cssProprty = (key: string, value: any): FlattenSimpleInterpolation =>
const cssProprty = (key: string, value): FlattenSimpleInterpolation =>
key &&
value &&
css`

View File

@ -1,5 +1,5 @@
import { StyledDiv } from 'components/Styled';
import { INTERVAL_UNITS } from 'container/TraceDetail/utils';
import { IIntervalUnit, INTERVAL_UNITS } from 'container/TraceDetail/utils';
import useThemeMode from 'hooks/useThemeMode';
import React, { useEffect, useState } from 'react';
import { useMeasure } from 'react-use';
@ -68,10 +68,9 @@ const Timeline = ({
{intervals &&
intervals.map((interval, index) => (
<TimelineInterval
transform={`translate(${
Timeline_H_Spacing +
transform={`translate(${Timeline_H_Spacing +
(interval.percentage * (width - 2 * Timeline_H_Spacing)) / 100
},0)`}
},0)`}
key={`${interval.label + interval.percentage + index}`}
>
<text y={13} fill={isDarkMode ? 'white' : 'black'}>
@ -93,7 +92,7 @@ const Timeline = ({
interface TimelineProps {
traceMetaData: object;
globalTraceMetadata: object;
intervalUnit: object;
intervalUnit: IIntervalUnit;
setIntervalUnit: any;
}

View File

@ -25,8 +25,7 @@ import { spanToTreeUtil } from 'utils/spanToTree';
import SelectedSpanDetails from './SelectedSpanDetails';
import * as styles from './styles';
import { getSortedData } from './utils';
import { INTERVAL_UNITS } from './utils';
import { getSortedData, IIntervalUnit, INTERVAL_UNITS } from './utils';
const TraceDetail = ({ response }: TraceDetailProps): JSX.Element => {
const spanServiceColors = useMemo(
@ -37,7 +36,9 @@ const TraceDetail = ({ response }: TraceDetailProps): JSX.Element => {
const urlQuery = useUrlQuery();
const [spanId] = useState<string | null>(urlQuery.get('spanId'));
const [intervalUnit, setIntervalUnit] = useState(INTERVAL_UNITS[0]);
const [intervalUnit, setIntervalUnit] = useState<IIntervalUnit>(
INTERVAL_UNITS[0],
);
// const [searchSpanString, setSearchSpanString] = useState('');
const [activeHoverId, setActiveHoverId] = useState<string>('');
const [activeSelectedId, setActiveSelectedId] = useState<string>(spanId || '');

View File

@ -5,7 +5,6 @@ import {
} from 'container/TraceDetail/utils';
import useThemeMode from 'hooks/useThemeMode';
import React, { useLayoutEffect, useMemo, useState } from 'react';
import { pushDStree } from 'store/actions';
import { ITraceTree } from 'types/api/trace/getTraceItem';
import { toFixed } from 'utils/toFixed';