Skip to content

Commit

Permalink
fix: minor bugs in web (#70)
Browse files Browse the repository at this point in the history
* fix: qa2

* fix: feedback detail and description
  • Loading branch information
chiol authored Oct 30, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ad5d9fe commit 7d57fd8
Showing 14 changed files with 61 additions and 60 deletions.
3 changes: 1 addition & 2 deletions apps/web/public/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -264,8 +264,7 @@
"today": "Today",
"yesterday": "Yesterday",
"before-days": "Before {{day, number}} days",
"date-range-over-max-days": "The inquiry period can only be entered up to {{maxDays}} days",
"all-dates": "The entire period"
"date-range-over-max-days": "The inquiry period can only be entered up to {{maxDays}} days"
},
"equal-search": "Equal",
"like-search": "Like"
3 changes: 1 addition & 2 deletions apps/web/public/locales/ja/common.json
Original file line number Diff line number Diff line change
@@ -254,8 +254,7 @@
"today": "今日",
"yesterday": "昨日",
"before-days": "{{day, number}}日前",
"date-range-over-max-days": "照会期間は最大{{maxDays}}日まで入力可能です。",
"all-dates": "全期間"
"date-range-over-max-days": "照会期間は最大{{maxDays}}日まで入力可能です。"
},
"equal-search": "完全一致",
"like-search": "部分一致"
3 changes: 1 addition & 2 deletions apps/web/public/locales/ko/common.json
Original file line number Diff line number Diff line change
@@ -254,8 +254,7 @@
"today": "오늘",
"yesterday": "어제",
"before-days": "{{day, number}}일전",
"date-range-over-max-days": "조회 기간은 최대 {{maxDays}}일까지만 입력 가능합니다.",
"all-dates": "전체 기간"
"date-range-over-max-days": "조회 기간은 최대 {{maxDays}}일까지만 입력 가능합니다."
},
"equal-search": "완전 일치",
"like-search": "부분 일치"
55 changes: 24 additions & 31 deletions apps/web/src/components/etc/DateRangePicker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
@@ -35,18 +35,19 @@ interface IProps extends React.PropsWithChildren {
maxDate?: Date;
maxDays?: number;
isClearable?: boolean;
disableTotalDateRange?: boolean;
}
const isTotalDateRange = (date: DateRangeType) => {
if (!date) return false;
if (!date.startDate || !date.endDate) return false;
return (
dayjs(date.startDate).format(DATE_FORMAT) === '1900-01-01' &&
dayjs(date.endDate).format(DATE_FORMAT) === '2999-12-31'
);
};

const DateRangePicker: React.FC<IProps> = (props) => {
const { value, onChange, maxDate, minDate, maxDays, isClearable } = props;
const {
value,
onChange,
maxDate,
minDate,
maxDays,
isClearable,
disableTotalDateRange,
} = props;

const { t, i18n } = useTranslation();

@@ -55,8 +56,8 @@ const DateRangePicker: React.FC<IProps> = (props) => {
const [isOpen, setIsOpen] = useState(false);
const [activeIdx, setActiveIdx] = useState(-1);

const items = useMemo(
() => [
const items = useMemo(() => {
return [
{
label: t('text.date.today'),
startDate: dayjs().toDate(),
@@ -82,14 +83,8 @@ const DateRangePicker: React.FC<IProps> = (props) => {
startDate: dayjs().subtract(90, 'days').toDate(),
endDate: dayjs().toDate(),
},
{
label: t('text.date.all-dates'),
startDate: dayjs('1900.01.01').toDate(),
endDate: dayjs('2999.12.31').toDate(),
},
],
[t],
);
];
}, [t, disableTotalDateRange]);

useEffect(() => {
setActiveIdx(-1);
@@ -132,17 +127,15 @@ const DateRangePicker: React.FC<IProps> = (props) => {
>
<p className="font-14-regular">
{currentValue
? isTotalDateRange(currentValue)
? t('text.date.all-dates')
: `${
currentValue?.startDate
? dayjs(currentValue?.startDate).format(DATE_FORMAT)
: ''
} ~ ${
currentValue?.endDate
? dayjs(currentValue.endDate).format(DATE_FORMAT)
: ''
}`
? `${
currentValue?.startDate
? dayjs(currentValue?.startDate).format(DATE_FORMAT)
: ''
} ~ ${
currentValue?.endDate
? dayjs(currentValue.endDate).format(DATE_FORMAT)
: ''
}`
: 'YYYY-MM-DD ~ YYYY-MM-DD'}
</p>
<div className="flex flex-row items-center gap-2">
@@ -193,7 +186,7 @@ const DateRangePicker: React.FC<IProps> = (props) => {
disabledKeyboardNavigation
selectsRange
inline
focusSelectedMonth={false}
autoFocus
/>
</div>
<div className="float-right flex gap-2 p-2">
7 changes: 1 addition & 6 deletions apps/web/src/components/layouts/SideNav/SideNav.tsx
Original file line number Diff line number Diff line change
@@ -120,12 +120,7 @@ const MenuItem: React.FC<IMenuItemProps> = ({
</span>
</button>
) : (
<Link
href={href}
onClick={() => {
if (activePathname === router.pathname) router.reload();
}}
>
<Link href={href}>
<button
className={[
'icon-btn icon-btn-tertiary icon-btn-md w-full flex-nowrap justify-start',
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ import type { SettingMenuType } from '@/types/setting-menu.type';
interface IProps extends React.PropsWithChildren {
projectId: number;
onClickSettingMenu: (input: SettingMenuType) => () => void;
settingMenu?: SettingMenuType;
settingMenu: SettingMenuType | null;
setChannelId: (id: number) => void;
channelId: number | null;
}
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import type { SettingMenuType } from '@/types/setting-menu.type';
interface IProps extends React.PropsWithChildren {
projectId: number;
onClickSettingMenu: (input: SettingMenuType) => () => void;
settingMenu?: SettingMenuType;
settingMenu: SettingMenuType | null;
}

const ProjectSettingMenu: React.FC<IProps> = (props) => {
2 changes: 1 addition & 1 deletion apps/web/src/containers/setting-menu/TenantSettingMenu.tsx
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ import type { SettingMenuType } from '@/types/setting-menu.type';

interface IProps extends React.PropsWithChildren {
onClickSettingMenu: (input: SettingMenuType) => () => void;
settingMenu?: SettingMenuType;
settingMenu: SettingMenuType | null;
}

const TenantSettingMenu: React.FC<IProps> = (props) => {
Original file line number Diff line number Diff line change
@@ -89,17 +89,14 @@ const FeedbackDetail: React.FC<IProps> = (props) => {
<Icon name="CloseCircleFill" size={20} />
</button>
</div>
<table className="border-separate border-spacing-y-5">
<colgroup>
<col style={{ minWidth: 80 }} />
</colgroup>
<table className="table-fixed border-separate border-spacing-y-5">
<tbody>
{channelData?.fields.sort(fieldSortType).map((field) => (
<tr key={field.name}>
<th className="font-14-regular text-secondary mr-2 text-left align-text-top">
<th className="font-14-regular text-secondary min-w-[80px] max-w-[80px] break-words text-left align-text-top">
{field.name}
</th>
<td className="font-14-regular text-primary">
<td className="font-14-regular text-primary break-words pl-2 align-top">
{field.key === 'issues' ? (
<div className="flex gap-2">
{(
Original file line number Diff line number Diff line change
@@ -173,6 +173,7 @@ const FeedbackTableBar: React.FC<IProps> = (props) => {
value={createdAtRange}
maxDate={new Date()}
maxDays={env.NEXT_PUBLIC_MAX_DAYS}
disableTotalDateRange
/>
</div>
{fieldData && (
1 change: 1 addition & 0 deletions apps/web/src/containers/tables/IssueTable/IssueTable.tsx
Original file line number Diff line number Diff line change
@@ -323,6 +323,7 @@ const IssueTable: React.FC<IProps> = ({ projectId }) => {
value={createdAtRange}
onChange={setCreatedAtRange}
maxDate={new Date()}
isClearable
/>
</div>
<TableSearchInput
27 changes: 21 additions & 6 deletions apps/web/src/pages/main/[projectId]/setting.tsx
Original file line number Diff line number Diff line change
@@ -13,8 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
import { useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import type { GetServerSideProps } from 'next';
import { useRouter } from 'next/router';
import { getIronSession } from 'iron-session';
import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
@@ -25,6 +26,7 @@ import { MainTemplate } from '@/components';
import { SettingMenuBox } from '@/components/layouts/setting-menu';
import { DEFAULT_LOCALE } from '@/constants/i18n';
import { ironOption } from '@/constants/iron-option';
import { Path } from '@/constants/path';
import {
APIKeySetting,
ChannelDeleteSetting,
@@ -52,19 +54,29 @@ interface IProps {

const SettingPage: NextPageWithLayout<IProps> = ({ projectId }) => {
const { t } = useTranslation();
const router = useRouter();

const [showList, setShowList] = useState<number[]>([0, 1, 2]);
const [channelId, setChannelId] = useState<number | null>(null);
const settingMenu = useMemo(() => {
if (router.query?.menu) return router.query.menu as SettingMenuType;
else return null;
}, [router.query]);

const [settingMenu, setSettingMenu] = useState<SettingMenuType>();
console.log('settingMenu: ', settingMenu);

const setSettingMenu = (input: SettingMenuType | null) =>
router.push({
pathname: Path.SETTINGS,
query: { menu: input ?? undefined, projectId },
});

const onClickReset = () => {
setShowList([0, 1, 2]);
setSettingMenu(undefined);
setSettingMenu(null);
};

const onClickTarget = (target?: SettingMenuType) => () => {
switch (target) {
useEffect(() => {
switch (settingMenu) {
case 'TENANT_INFO':
case 'SIGNUP_SETTING':
case 'USER_MANAGEMENT':
@@ -87,6 +99,9 @@ const SettingPage: NextPageWithLayout<IProps> = ({ projectId }) => {
setShowList([0, 1, 2]);
break;
}
}, [router.query]);

const onClickTarget = (target: SettingMenuType | null) => () => {
setSettingMenu(target);
};

2 changes: 1 addition & 1 deletion apps/web/src/utils/description-string.ts
Original file line number Diff line number Diff line change
@@ -16,5 +16,5 @@
export const getDescriptionStr = (str?: string | null) => {
if (!str) return '-';
str = str.trim();
return str.length === 0 ? str : '-';
return str.length !== 0 ? str : '-';
};
4 changes: 3 additions & 1 deletion packages/ufb-ui/src/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -91,7 +91,9 @@ export const Tooltip: React.FC<ITooltipProps> = ({
style={floatingStyles}
{...getFloatingProps()}
>
<p className="text-fill-inverse font-12-regular">{description}</p>
<p className="text-fill-inverse font-12-regular max-w-[200px] break-words">
{description}
</p>
<FloatingArrow ref={arrowRef} context={context} />
</div>
)}

0 comments on commit 7d57fd8

Please sign in to comment.