📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Project View panels to ts
kruzhambus900d10e92a7c
diff --git a/src/pages/Project/View/Panels.jsx b/src/pages/Project/View/Panels.tsxsimilarity index 95%rename from src/pages/Project/View/Panels.jsxrename to src/pages/Project/View/Panels.tsxindex ff4b792aa..4072d2b80 100644--- a/src/pages/Project/View/Panels.jsx+++ b/src/pages/Project/View/Panels.tsx@@ -39,20 +39,30 @@ const ENTRIES_PER_PANEL = 5const panelsWithBars = ['cc', 'ce', 'os', 'br', 'dv']// function that checks if there are custom tabs for a specific type-const checkCustomTabs = (panelID, customTabs) => {+const checkCustomTabs = (panelID: string, customTabs: any) => {if (_isEmpty(customTabs)) return falsereturn Boolean(_find(customTabs, (el) => el.panelID === panelID))}-const checkIfBarsNeeded = (panelID) => {+const checkIfBarsNeeded = (panelID: string) => {return _includes(panelsWithBars, panelID)}// noSwitch - 'previous' and 'next' buttonsconst PanelContainer = ({name, children, noSwitch, icon, type, openModal, activeFragment, setActiveFragment, customTabs,-}) => (+}: {+ name: string,+ children?: React.ReactNode,+ noSwitch?: boolean,+ icon?: React.ReactNode,+ type: string,+ openModal?: () => void,+ activeFragment: number | string,+ setActiveFragment: (arg: number) => void,+ customTabs?: any,+}): JSX.Element => (<divclassName={cx('relative bg-white dark:bg-gray-750 pt-5 px-4 min-h-72 sm:pt-6 sm:px-6 shadow rounded-lg overflow-hidden', {'pb-12': !noSwitch,@@ -145,11 +155,21 @@ PanelContainer.defaultProps = {noSwitch: false,activeFragment: 0,setActiveFragment: () => { },+ openModal: () => { },+ customTabs: [],}// First tab with statsconst Overview = ({overall, chartData, activePeriod, t, live, sessionDurationAVG, projectId,+}: {+ overall: any+ chartData: any+ activePeriod: any+ t: (arg: string) => string+ live: number+ sessionDurationAVG: number+ projectId: string}) => {const pageviewsDidGrowUp = overall.percChange >= 0const uniqueDidGrowUp = overall.percChangeUnique >= 0@@ -162,7 +182,7 @@ const Overview = ({}return (- <PanelContainer name={t('project.overview')} noSwitch>+ <PanelContainer name={t('project.overview')} noSwitch type='' openModal={() => {}}><div className='flex text-lg justify-between'><div className='flex items-center dark:text-gray-50'><PulsatingCircle className='mr-1.5' type='big' />@@ -301,7 +321,7 @@ const Overview = ({}// Options for circle chart showing the stats of data-const getPieOptions = (customs, uniques, t) => {+const getPieOptions = (customs: any, uniques: number, t: any) => {const tQuantity = t('project.quantity')const tConversion = t('project.conversion')const tRatio = t('project.ratio')@@ -345,11 +365,16 @@ const getPieOptions = (customs, uniques, t) => {// Tabs with custom events like submit form, press button, go to the link rate etc.const CustomEvents = ({customs, chartData, onFilter, t,+}: {+ customs: any+ chartData: any+ onFilter: any+ t: (arg0: string) => string}) => {const keys = _keys(customs)const uniques = _sum(chartData.uniques)- const [chartOptions, setChartOptions] = useState({})- const [activeFragment, setActiveFragment] = useState(0)+ const [chartOptions, setChartOptions] = useState<any>({})+ const [activeFragment, setActiveFragment] = useState<number>(0)useEffect(() => {if (!_isEmpty(chartData)) {@@ -437,7 +462,20 @@ CustomEvents.propTypes = {const Panel = ({name, data, rowMapper, valueMapper, capitalize, linkContent, t, icon, id, hideFilters, onFilter, customTabs,-}) => {+}: {+ name: string+ data: any+ rowMapper: any+ valueMapper: any+ capitalize: boolean+ linkContent: boolean+ t: (arg0: string) => string+ icon: any+ id: string+ hideFilters: boolean+ onFilter: any+ customTabs?: any+}): JSX.Element => {const [page, setPage] = useState(0)const currentIndex = page * ENTRIES_PER_PANELconst keys = useMemo(() => _keys(data).sort((a, b) => data[b] - data[a]), [data])@@ -721,6 +759,7 @@ Panel.defaultProps = {onFilter: () => { },hideFilters: false,icon: null,+ customTabs: [],}const PanelMemo = memo(Panel)diff --git a/src/ui/Button.tsx b/src/ui/Button.tsxindex f0459e9b9..2c13b1b64 100644--- a/src/ui/Button.tsx+++ b/src/ui/Button.tsx@@ -8,7 +8,7 @@ import Spin from './icons/Spin'import './ButtonChristmas.css'const Button = ({- text, children, primary, secondary, danger, onClick, white, small, regular, large, giant, type, className, loading, semiSmall, semiDanger, noBorder, focus,+ text, children, primary, secondary, danger, onClick, white, small, regular, large, giant, type, className, loading, semiSmall, semiDanger, noBorder, focus, disabled,}: {text?: string,children?: JSX.Element | string,@@ -28,11 +28,13 @@ const Button = ({semiDanger?: boolean,focus?: boolean,noBorder?: boolean,+ disabled?: boolean,}): JSX.Element => {// const themeType = useSelector((state) => state.ui.theme.type)return (<button+ disabled={disabled}type={type}onClick={onClick}className={cx('relative inline-flex select-none items-center border leading-4 font-medium rounded-md', {@@ -97,6 +99,7 @@ Button.propTypes = {loading: PropTypes.bool,focus: PropTypes.bool,noBorder: PropTypes.bool,+ disabled: PropTypes.bool,}Button.defaultProps = {@@ -118,6 +121,7 @@ Button.defaultProps = {children: null,focus: true,noBorder: false,+ disabled: false,}export default memo(Button)