From e69190abb09661caa19fa3905a0d8f3b7e72648b Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 13 Jul 2020 20:59:52 +0800 Subject: Move front end to a submodule. --- Timeline/ClientApp/src/app/user/UserInfoCard.tsx | 116 ----------------------- 1 file changed, 116 deletions(-) delete mode 100644 Timeline/ClientApp/src/app/user/UserInfoCard.tsx (limited to 'Timeline/ClientApp/src/app/user/UserInfoCard.tsx') diff --git a/Timeline/ClientApp/src/app/user/UserInfoCard.tsx b/Timeline/ClientApp/src/app/user/UserInfoCard.tsx deleted file mode 100644 index b4924a5d..00000000 --- a/Timeline/ClientApp/src/app/user/UserInfoCard.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import React from 'react'; -import clsx from 'clsx'; -import { - Dropdown, - DropdownToggle, - DropdownMenu, - DropdownItem, - Button, -} from 'reactstrap'; -import { useTranslation } from 'react-i18next'; -import { fromEvent } from 'rxjs'; - -import { - TimelineInfo, - timelineVisibilityTooltipTranslationMap, -} from '../data/timeline'; -import { useAvatarVersion, useAvatarUrlWithGivenVersion } from './api'; -import { useUser } from '../data/user'; - -import { TimelineCardComponentProps } from '../timeline/TimelinePageTemplateUI'; - -export type PersonalTimelineManageItem = 'avatar' | 'nickname'; - -export type UserInfoCardProps = TimelineCardComponentProps< - TimelineInfo, - PersonalTimelineManageItem ->; - -const UserInfoCard: React.FC = (props) => { - const { onHeight, onManage } = props; - const { t } = useTranslation(); - const user = useUser(); - - const avatarVersion = useAvatarVersion(); - const avatarUrl = useAvatarUrlWithGivenVersion( - user != null && user.username === props.timeline.owner.username - ? avatarVersion - : undefined, - props.timeline.owner._links.avatar - ); - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const containerRef = React.useRef(null!); - - const notifyHeight = React.useCallback((): void => { - if (onHeight) { - onHeight(containerRef.current.getBoundingClientRect().height); - } - }, [onHeight]); - - React.useEffect(() => { - const subscription = fromEvent(window, 'resize').subscribe(notifyHeight); - return () => subscription.unsubscribe(); - }); - - const [manageDropdownOpen, setManageDropdownOpen] = React.useState( - false - ); - const toggleManageDropdown = React.useCallback( - (): void => setManageDropdownOpen((old) => !old), - [] - ); - - return ( -
- -
- {props.timeline.owner.nickname} - - @{props.timeline.owner.username} - -
-

{props.timeline.description}

- - {t(timelineVisibilityTooltipTranslationMap[props.timeline.visibility])} - -
- {onManage != null ? ( - - - {t('timeline.manage')} - - - onManage('nickname')}> - {t('timeline.manageItem.nickname')} - - onManage('avatar')}> - {t('timeline.manageItem.avatar')} - - onManage('property')}> - {t('timeline.manageItem.property')} - - - {t('timeline.manageItem.member')} - - - - ) : ( - - )} -
-
- ); -}; - -export default UserInfoCard; -- cgit v1.2.3