Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add organization filter #352

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/i18n
Submodule i18n updated 2 files
+1 −1 en/analyze.json
+1 −0 zh/analyze.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import React, { useState } from 'react';
import { Button, Input } from 'antd';
import { useTranslation } from 'next-i18next';

const ContributorDropdown = ({ selectedKeys, setSelectedKeys, confirm }) => {
const ContributorDropdown = ({
selectedKeys,
setSelectedKeys,
confirm,
placeholder,
}) => {
const { t } = useTranslation();
const [contributor, setContributor] = useState(selectedKeys);

Expand All @@ -17,7 +22,7 @@ const ContributorDropdown = ({ selectedKeys, setSelectedKeys, confirm }) => {
return (
<div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}>
<Input
placeholder={t('analyze:metric_detail:search_contributor')}
placeholder={placeholder}
value={contributor[0]}
onChange={(e) => setContributor([e.target.value])}
onPressEnter={() => handleSearch()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ const MetricTable: React.FC<{
selectedKeys={selectedKeys}
setSelectedKeys={setSelectedKeys}
confirm={confirm}
placeholder={t('analyze:metric_detail:search_contributor')}
/>
);
},
Expand Down Expand Up @@ -299,6 +300,25 @@ const MetricTable: React.FC<{
</div>
);
},
filterIcon: (filtered: boolean) => (
<AiFillFilter
className="text-sm"
style={{ color: filtered ? '#1677ff' : undefined }}
/>
),
defaultFilteredValue:
defaultFilterOpts.find((i) => i.type === 'organization')?.values ||
null,
filterDropdown: ({ selectedKeys, setSelectedKeys, confirm }) => {
return (
<ContributorDropdown
selectedKeys={selectedKeys}
setSelectedKeys={setSelectedKeys}
confirm={confirm}
placeholder={t('analyze:metric_detail:search_organization')}
/>
);
},
},
{
title: t('analyze:metric_detail:contribution'),
Expand Down
Loading