-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: laixingyou <[email protected]>
- Loading branch information
1 parent
0e1295c
commit 823ef52
Showing
51 changed files
with
1,317 additions
and
696 deletions.
There are no files selected for viewing
Submodule i18n
updated
4 files
+23 −18 | en/analyze.json | |
+17 −0 | en/metrics_models.json | |
+8 −3 | zh/analyze.json | |
+17 −0 | zh/metrics_models.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/web/src/modules/analyze/DataView/ContributorDetail.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'next-i18next'; | ||
import TopicTitle from '@modules/analyze/components/TopicTitle'; | ||
import { Topic } from '@modules/analyze/components/SideBar/config'; | ||
import { CiGrid41 } from 'react-icons/ci'; | ||
import MetricDashboard from '@modules/analyze/DataView/MetricDetail/MetricDashboard'; | ||
import ProductivityIcon from '@modules/analyze/components/SideBar/assets/Productivity.svg'; | ||
import MetricDetail from './MetricDetail'; | ||
|
||
const ContributorDetail = () => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<h1 | ||
className={ | ||
'group relative z-20 mt-2 mb-8 flex scroll-mt-[200px] text-3xl font-semibold md:px-4 md:text-3xl' | ||
} | ||
id={Topic.Overview} | ||
> | ||
<CiGrid41 className="mt-2 mr-2 h-[21px] w-[21px] flex-shrink-0" /> | ||
{t('analyze:overview')} | ||
<a href={`#${Topic.Overview}`}> | ||
<span className="group-hover:text-primary invisible ml-2 cursor-pointer group-hover:visible"> | ||
# | ||
</span> | ||
</a> | ||
</h1> | ||
<MetricDashboard /> | ||
<TopicTitle | ||
icon={<ProductivityIcon className="mt-2 mr-2 h-[21px] w-[21px]" />} | ||
id={Topic.Productivity} | ||
> | ||
{t('analyze:topic.productivity')} | ||
</TopicTitle> | ||
<MetricDetail /> | ||
</> | ||
); | ||
}; | ||
|
||
export default ContributorDetail; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
175 changes: 175 additions & 0 deletions
175
apps/web/src/modules/analyze/DataView/MetricDetail/MetricContributor/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
import React, { useState } from 'react'; | ||
import Tabs from '@mui/material/Tabs'; | ||
import Tab from '@mui/material/Tab'; | ||
import useQueryDateRange from '@modules/analyze/hooks/useQueryDateRange'; | ||
import { Checkbox } from 'antd'; | ||
import { useTranslation } from 'next-i18next'; | ||
import { useMileageOptions } from './contribution'; | ||
import MetricTable from './ContributorTable'; | ||
import ContributorContribution from './ContributorContribution'; | ||
import ContributorOrganizations from './ContributorOrganizations'; | ||
import ContributorContributors from './ContributorContributors'; | ||
import { AiOutlineQuestionCircle } from 'react-icons/ai'; | ||
import Tooltip from '@common/components/Tooltip'; | ||
import useLabelStatus from '@modules/analyze/hooks/useLabelStatus'; | ||
import { ContributorsPersona } from '@modules/analyze/components/SideBar/config'; | ||
import BaseCard from '@common/components/BaseCard'; | ||
|
||
const MetricContributor = () => { | ||
const { t } = useTranslation(); | ||
const { verifiedItems } = useLabelStatus(); | ||
const { label, level } = verifiedItems[0]; | ||
const [tab, setTab] = useState('1'); | ||
const { timeStart, timeEnd } = useQueryDateRange(); | ||
const options = useMileageOptions(); | ||
const [mileage, setMileage] = useState<string[]>(['core', 'guest']); | ||
const onChange = (checkedValues: string[]) => { | ||
setMileage(checkedValues); | ||
}; | ||
let source; | ||
switch (tab) { | ||
case '1': { | ||
source = ( | ||
<MetricTable | ||
label={label} | ||
level={level} | ||
beginDate={timeStart} | ||
endDate={timeEnd} | ||
mileage={mileage} | ||
/> | ||
); | ||
break; | ||
} | ||
case '2': { | ||
source = ( | ||
<ContributorContribution | ||
label={label} | ||
level={level} | ||
beginDate={timeStart} | ||
endDate={timeEnd} | ||
mileage={mileage} | ||
/> | ||
); | ||
break; | ||
} | ||
case '3': { | ||
source = ( | ||
<ContributorOrganizations | ||
label={label} | ||
level={level} | ||
beginDate={timeStart} | ||
endDate={timeEnd} | ||
mileage={mileage} | ||
/> | ||
); | ||
break; | ||
} | ||
case '4': { | ||
source = ( | ||
<ContributorContributors | ||
label={label} | ||
level={level} | ||
beginDate={timeStart} | ||
endDate={timeEnd} | ||
mileage={mileage} | ||
/> | ||
); | ||
break; | ||
} | ||
default: { | ||
break; | ||
} | ||
} | ||
return ( | ||
<BaseCard | ||
title={t('metrics_models:contributors_persona.metrics.contributor')} | ||
id={ContributorsPersona.Contributor} | ||
bodyClass="h-[650px]" | ||
> | ||
<div> | ||
<Tabs | ||
classes={{ flexContainer: 'border-b', indicator: '!bg-black' }} | ||
value={tab} | ||
onChange={(e, v) => { | ||
setTab(v); | ||
}} | ||
aria-label="Tabs where selection follows focus" | ||
selectionFollowsFocus | ||
> | ||
<Tab | ||
disableRipple | ||
classes={{ root: '!normal-case', selected: '!text-black ' }} | ||
label={t('analyze:metric_detail:persona_detail')} | ||
value="1" | ||
></Tab> | ||
<Tab | ||
disableRipple | ||
classes={{ | ||
root: '!normal-case', | ||
selected: '!text-black !normal-case', | ||
}} | ||
label={t('analyze:metric_detail:contribution')} | ||
value="2" | ||
/> | ||
<Tab | ||
disableRipple | ||
classes={{ | ||
root: '!normal-case', | ||
selected: '!text-black !normal-case', | ||
}} | ||
label={t('analyze:metric_detail:organization')} | ||
value="3" | ||
/> | ||
<Tab | ||
disableRipple | ||
classes={{ | ||
root: '!normal-case', | ||
selected: '!text-black !normal-case', | ||
}} | ||
label={t('analyze:metric_detail:contributor')} | ||
value="4" | ||
/> | ||
</Tabs> | ||
<div className="absolute right-1 top-2.5 flex lg:hidden"> | ||
<span className="mr-2 flex items-center font-medium"> | ||
{t('analyze:metric_detail:milestone_persona_filter')} | ||
<Tooltip | ||
arrow | ||
title={ | ||
<> | ||
<div> | ||
<span className="font-xs font-semibold"> | ||
{t('analyze:metric_detail:core')} : | ||
</span> | ||
{t('analyze:metric_detail:core_desc')} | ||
</div> | ||
<div> | ||
<span className="font-xs font-semibold"> | ||
{t('analyze:metric_detail:regular')} : | ||
</span> | ||
{t('analyze:metric_detail:regular_desc')} | ||
</div> | ||
</> | ||
} | ||
placement="right" | ||
> | ||
<span className="ml-1 text-gray-400"> | ||
<AiOutlineQuestionCircle /> | ||
</span> | ||
</Tooltip> | ||
</span> | ||
<span className="mr-2">:</span> | ||
<Checkbox.Group | ||
options={options} | ||
defaultValue={['core', 'guest']} | ||
onChange={onChange} | ||
/> | ||
</div> | ||
|
||
<div className="mt-2 flex h-[600px] flex-1 flex-col">{source}</div> | ||
</div> | ||
</BaseCard> | ||
); | ||
}; | ||
|
||
export default MetricContributor; |
Oops, something went wrong.