diff --git a/.gitignore b/.gitignore index 01377a572..4438999ee 100755 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,8 @@ yarn-error.log .env.local schema.graphql cypress//integration/examples -cypress/videos/ .vscode/ .DS_Store .eslintcache + +cypress/videos/* \ No newline at end of file diff --git a/src/components/ContentFilter/DesktopView.js b/src/components/ContentFilter/DesktopView.js index 348e8e8d2..78c18f19e 100644 --- a/src/components/ContentFilter/DesktopView.js +++ b/src/components/ContentFilter/DesktopView.js @@ -62,7 +62,6 @@ ContentFilter.propTypes = { field: T.string, finance: T.string, scale: T.string, - // video source: T.string, }), onSelect: T.func.isRequired, @@ -90,7 +89,6 @@ ContentFilter.defaultProps = { field: '', finance: '', scale: '', - // video source: '', }, thread: THREAD.POST, diff --git a/src/components/ContentFilter/FilterPanel/VideoSourceFilter.js b/src/components/ContentFilter/FilterPanel/VideoSourceFilter.js deleted file mode 100755 index b88243476..000000000 --- a/src/components/ContentFilter/FilterPanel/VideoSourceFilter.js +++ /dev/null @@ -1,48 +0,0 @@ -import React from 'react' - -import { ICON_CMD } from '@/config' - -import { - ColumnWrapper, - SelectLabel, - LabelDivider, - SelectIcon, - SelectTitle, - SelectItem, -} from '../styles' - -const VideoSourceFilter = ({ activeFilter, onSelect }) => ( - - - - 来源 - - - onSelect({ source: 'youtube' })} - > - youtube - - onSelect({ source: 'vimeo' })} - > - vimeo - - onSelect({ source: 'bilibili' })} - > - B站 - - onSelect({ videoSource: 'other' })} - > - 其他网站 - - -) - -export default React.memo(VideoSourceFilter) diff --git a/src/components/ContentFilter/FilterPanel/index.js b/src/components/ContentFilter/FilterPanel/index.js index a57135b3c..24825019e 100644 --- a/src/components/ContentFilter/FilterPanel/index.js +++ b/src/components/ContentFilter/FilterPanel/index.js @@ -14,8 +14,6 @@ import JobEducationFilter from './JobEducationFilter' import JobFieldFilter from './JobFieldFilter' import JobFinanceFilter from './JobFinanceFilter' import JobScaleFilter from './JobScaleFilter' -// video -import VideoSourceFilter from './VideoSourceFilter' import { FilterPanelWrapper } from '../styles' @@ -33,18 +31,6 @@ const FilterPanel = ({ thread, activeFilter, onSelect, isLogin }) => { ) - case THREAD.VIDEO: - return ( - - - - - {isLogin && ( - - )} - - ) - case THREAD.REPO: return ( diff --git a/src/components/LoadingEffects/VideoItemLoading.js b/src/components/LoadingEffects/VideoItemLoading.js deleted file mode 100755 index baef81996..000000000 --- a/src/components/LoadingEffects/VideoItemLoading.js +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react' -import T from 'prop-types' -import { range } from 'ramda' -import styled, { useTheme } from 'styled-components' -import ContentLoader from 'react-content-loader' - -// Config-page: http://danilowoz.com/create-react-content-loader/ -const LoadingWrapper = styled.div` - width: 100%; - overflow: hidden; -` - -const LoadingItem = ({ theme }) => ( - - - - - - - - - -) - -const VideoItemLoading = ({ num }) => { - const theme = useTheme() - - return range(0, num).map((item) => ( - - - - )) -} - -VideoItemLoading.propTypes = { - num: T.number, -} - -VideoItemLoading.defaultProps = { - num: 1, -} - -export default VideoItemLoading diff --git a/src/components/LoadingEffects/index.js b/src/components/LoadingEffects/index.js index 9ba60f444..b030f9949 100755 --- a/src/components/LoadingEffects/index.js +++ b/src/components/LoadingEffects/index.js @@ -7,7 +7,6 @@ export { default as CheatSheetLoading } from './CheatSheetLoading' export { default as CommentLoading } from './CommentLoading' export { default as PostItemLoading } from './PostItemLoading' -export { default as VideoItemLoading } from './VideoItemLoading' export { default as RepoItemLoading } from './RepoItemLoading' export { default as JobItemLoading } from './JobItemLoading' export { default as EditorLoading } from './EditorLoading' diff --git a/src/components/PagedContents/ContentList.js b/src/components/PagedContents/ContentList.js index 7aa385ba4..16f14ec2e 100755 --- a/src/components/PagedContents/ContentList.js +++ b/src/components/PagedContents/ContentList.js @@ -8,7 +8,6 @@ import { THREAD } from '@/constant' import { PostItemLoading, JobItemLoading, - VideoItemLoading, RepoItemLoading, } from '@/components/LoadingEffects' @@ -18,9 +17,6 @@ export const PostsList = dynamic(() => import('./PostsList'), { const JobsList = dynamic(() => import('./JobsList'), { loading: () => , }) -const VideosList = dynamic(() => import('./VideosList'), { - loading: () => , -}) const ReposList = dynamic(() => import('./ReposList'), { loading: () => , }) @@ -32,9 +28,6 @@ const ContentList = (props) => { case THREAD.JOB: return - case THREAD.VIDEO: - return - case THREAD.REPO: return diff --git a/src/components/PagedContents/VideosList.js b/src/components/PagedContents/VideosList.js deleted file mode 100755 index c819e9c28..000000000 --- a/src/components/PagedContents/VideosList.js +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react' -import { isEmpty } from 'ramda' - -import { TYPE } from '@/constant' -import { Trans } from '@/utils' -import { VideoItemLoading } from '@/components/LoadingEffects' -import VideoItem from '@/components/VideoItem' - -import EmptyThread from '@/components/EmptyThread' -import EmptyLabel from '@/components/EmptyLabel' - -const VideosList = ({ props }) => { - const { - entries, - active, - curView, - community, - thread, - emptyPrefix, - onPreview, - accountInfo, - } = props - - switch (curView) { - case TYPE.RESULT: - return ( - <> - {entries.map((entry) => ( - onPreview(entry)} - /> - ))} - - ) - - case TYPE.RESULT_EMPTY: - return ( - <> - {isEmpty(emptyPrefix) ? ( - - ) : ( - - )} - - ) - - default: - return - } -} - -export default React.memo(VideosList) diff --git a/src/components/PagedContents/index.js b/src/components/PagedContents/index.js index 1e8e2ed07..95679d099 100755 --- a/src/components/PagedContents/index.js +++ b/src/components/PagedContents/index.js @@ -65,7 +65,7 @@ const PagedContents = ({ } PagedContents.propTypes = { - thread: T.oneOf([THREAD.POST, THREAD.JOB, THREAD.VIDEO, THREAD.REPO]), + thread: T.oneOf([THREAD.POST, THREAD.JOB, THREAD.REPO]), cover: T.oneOf(['avatar', 'source']), active: T.object, data: T.shape({ diff --git a/src/components/Switcher/Tabs/LocalIcon.js b/src/components/Switcher/Tabs/LocalIcon.js index f08b029df..417cba87b 100644 --- a/src/components/Switcher/Tabs/LocalIcon.js +++ b/src/components/Switcher/Tabs/LocalIcon.js @@ -8,7 +8,6 @@ import { TabCityIcon, TabJobIcon, TabWikiIcon, - TabVideoIcon, TabRepoIcon, TabCheatsheetIcon, // user @@ -43,9 +42,6 @@ const TabIcon = ({ raw, active, small }) => { case 'wiki': return - case 'video': - return - case 'repo': return diff --git a/src/components/Switcher/styles/tabs/local_icon.ts b/src/components/Switcher/styles/tabs/local_icon.ts index 5c959eca6..094a7b968 100644 --- a/src/components/Switcher/styles/tabs/local_icon.ts +++ b/src/components/Switcher/styles/tabs/local_icon.ts @@ -11,7 +11,6 @@ import TabCitySVG from '@/SvgIcons/TabCitySVG' import TabJobSVG from '@/SvgIcons/TabJobSVG' // import TabWikiSVG from '@/SvgIcons/TabWikiSVG' -import TabVideoSVG from '@/SvgIcons/TabVideoSVG' import TabRepoSVG from '@/SvgIcons/TabRepoSVG' import TabCheatsheetSVG from '@/SvgIcons/TabCheatsheetSVG' @@ -45,7 +44,6 @@ export const TabUserIcon = commonIcon(TabUserSVG) export const TabCityIcon = commonIcon(TabCitySVG) export const TabJobIcon = commonIcon(TabJobSVG) export const TabWikiIcon = commonIcon(TabWikiSVG) -export const TabVideoIcon = commonIcon(TabVideoSVG) export const TabRepoIcon = commonIcon(TabRepoSVG) export const TabCheatsheetIcon = commonIcon(TabCheatsheetSVG) diff --git a/src/components/ThreadSelector/index.js b/src/components/ThreadSelector/index.js index 894b41af2..13aa7c0fc 100755 --- a/src/components/ThreadSelector/index.js +++ b/src/components/ThreadSelector/index.js @@ -65,7 +65,7 @@ ThreadSelector.propTypes = { } ThreadSelector.defaultProps = { - options: [THREAD.POST, THREAD.VIDEO, THREAD.REPO, THREAD.JOB], + options: [THREAD.POST, THREAD.REPO, THREAD.JOB], active: THREAD.POST, onSelect: log, totalCount: 0, diff --git a/src/components/VideoInfoCard/index.js b/src/components/VideoInfoCard/index.js deleted file mode 100755 index c823720cf..000000000 --- a/src/components/VideoInfoCard/index.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * VideoInfoCard - * - */ - -import React from 'react' -import T from 'prop-types' -import TimeAgo from 'timeago-react' - -import { ICON_CMD } from '@/config' - -import { buildLog, cutRest } from '@/utils' -import DotDivider from '@/components/DotDivider' -import VideoSourceInfo from '@/components/VideoSourceInfo' - -import { - Wrapper, - BaseInfo, - Title, - Desc, - Footer, - OriginAuthor, - OriginAuthorLink, - PublishTime, - OtherInfo, - Duration, - DurationIcon, - DurationText, - Source, -} from './styles' - -/* eslint-disable-next-line */ -const log = buildLog('c:VideoInfoCard:index') - -const VideoInfoCard = ({ data }) => { - const { - title, - desc, - originalAuthor, - originalAuthorLink, - publishAt, - duration, - source, - } = data - - return ( - - - {cutRest(title, 40)} - {desc} -
- - 原作者:{' '} - - {originalAuthor} - - - - - 搬运于: - -
-
- - - 来源: - - - - - {duration} - - -
- ) -} - -VideoInfoCard.propTypes = { - data: T.shape({ - title: T.string, - desc: T.string, - originalAuthor: T.string, - originalAuthorLink: T.string, - publishAt: T.string, - duration: T.string, - source: T.string, - }).isRequired, -} - -VideoInfoCard.defaultProps = {} - -export default React.memo(VideoInfoCard) diff --git a/src/components/VideoInfoCard/styles/index.ts b/src/components/VideoInfoCard/styles/index.ts deleted file mode 100755 index a4fb29663..000000000 --- a/src/components/VideoInfoCard/styles/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -import styled from 'styled-components' - -import { theme, css } from '@/utils' -import Img from '@/Img' - -export const Wrapper = styled.div` - ${css.flex()}; - padding: 20px 40px; - background: ${theme('drawer.articleBg')}; - min-height: 120px; - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); - ${css.media.mobile` - padding: 10px 0; - box-shadow: none; - `}; -` -export const BaseInfo = styled.div` - ${css.flexColumnGrow()}; -` -export const Title = styled.div` - color: ${theme('thread.articleTitle')}; - font-size: 1.1rem; - margin-bottom: 5px; -` -export const Desc = styled.div` - color: ${theme('thread.articleDigest')}; - font-size: 0.9rem; -` -export const Footer = styled.div` - ${css.flex('align-center')}; - color: ${theme('thread.articleDigest')}; - margin-top: 20px; -` -export const OriginAuthor = styled.div` - font-size: 1rem; - ${css.media.mobile` -font-size: 0.9rem; -`}; -` -export const OriginAuthorLink = styled.a` - color: ${theme('thread.articleDigest')}; - font-weight: bold; - transition: color 0.3s; - margin-left: 2px; - margin-right: 2px; - &:hover { - color: ${theme('banner.title')}; - text-decoration: underline; - cursor: pointer; - } -` -export const PublishTime = styled.div` - font-size: 1rem; - ${css.media.mobile` -font-size: 0.9rem; -`}; -` -export const OtherInfo = styled.div` - ${css.flexColumn('justify-between')}; -` -export const Duration = styled.div` - ${css.flex('align-center', 'justify-end')}; - color: ${theme('thread.articleDigest')}; - min-width: 120px; -` -export const DurationText = styled.div` - font-size: 1rem; -` -export const DurationIcon = styled(Img)` - fill: ${theme('thread.articleDigest')}; - ${css.size(16)}; - margin-top: -1px; - margin-right: 5px; -` -export const Source = styled.div` - ${css.flex('align-center', 'justify-end')}; - color: ${theme('thread.articleDigest')}; - font-size: 0.8rem; - min-width: 120px; - text-align: right; -` diff --git a/src/components/VideoInfoCard/tests/index.test.ts b/src/components/VideoInfoCard/tests/index.test.ts deleted file mode 100755 index 0261ffda2..000000000 --- a/src/components/VideoInfoCard/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoInfoCard from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/components/VideoItem/helper.js b/src/components/VideoItem/helper.js deleted file mode 100755 index 373d6f781..000000000 --- a/src/components/VideoItem/helper.js +++ /dev/null @@ -1,18 +0,0 @@ -export const getOpacity = (entry, active, accountInfo) => { - const { - isLogin, - customization: { markViewed }, - } = accountInfo - const { viewerHasViewed } = entry - - if (active.id) { - return entry.id !== active.id ? 0.6 : 1 - } - if (isLogin && markViewed && viewerHasViewed) { - return 0.85 - } - - return 1 -} - -export const holder = 1 diff --git a/src/components/VideoItem/index.js b/src/components/VideoItem/index.js deleted file mode 100755 index 20dc6f40a..000000000 --- a/src/components/VideoItem/index.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * - * VideoItem - * - */ - -import React from 'react' -import T from 'prop-types' -import TimeAgo from 'timeago-react' - -import { ICON_CMD } from '@/config' -import { C11N } from '@/constant' -import { buildLog, cutRest } from '@/utils' - -import DotDivider from '@/components/DotDivider' -import VideoSourceInfo from '@/components/VideoSourceInfo' -import { Space } from '@/components/Common' -import InlineTags from '@/components/InlineTags' -import ArticleItemPrefixLabel from '@/components/ArticleItemPrefixLabel' - -import { - Wrapper, - PosterWrapper, - Poster, - Duration, - ViewIcon, - Main, - TopHalf, - Brief, - Title, - SecondHalf, - BodyDigest, - Extra, - OriginalAuthorLink, - BottomAuthorWrapper, - ButtonAvatar, - ButtonNickname, - InsertTime, -} from './styles' - -import { getOpacity } from './helper' - -/* eslint-disable-next-line */ -const log = buildLog('c:VideoItem:index') - -const VideoItem = ({ entry, active, onPreview, accountInfo }) => ( - - - - - {entry.duration} - -
- - onPreview(entry)}> - {entry.title} - - - - - - - - - {entry.originalAuthor} - {' '} - - - - - {entry.views} - - {cutRest(entry.desc, 90)} - - - - {entry.author.nickname} - - - - - -
-
-) - -VideoItem.propTypes = { - active: T.object, - - entry: T.shape({ - title: T.string, - views: T.number, - publishAt: T.string, - insertedAt: T.string, - desc: T.string, - source: T.string, - tags: T.object, - duration: T.string, - thumbnil: T.string, - originalAuthor: T.string, - originalAuthorLink: T.string, - - author: T.shape({ - nickname: T.string, - avatar: T.string, - }), - }).isRequired, - - accountInfo: T.shape({ - isLogin: T.bool, - customization: T.shape({ - contentsLayout: T.oneOf([C11N.DIGEST, C11N.LIST]), - markViewed: T.bool, - displayDensity: T.oneOf(['20', '25', '30']), - }), - }), - onPreview: T.func, -} - -VideoItem.defaultProps = { - onPreview: log, - active: {}, - accountInfo: { - isLogin: false, - customization: T.shape({ - contentsLayout: C11N.DIGEST, - markViewed: true, - displayDensity: '20', - }), - }, -} - -export default React.memo(VideoItem) diff --git a/src/components/VideoItem/styles/index.ts b/src/components/VideoItem/styles/index.ts deleted file mode 100755 index a456f6129..000000000 --- a/src/components/VideoItem/styles/index.ts +++ /dev/null @@ -1,142 +0,0 @@ -import styled from 'styled-components' - -import { theme, css } from '@/utils' -import Img from '@/Img' - -export const Wrapper = styled.article<{ opacity: number }>` - ${css.flex()}; - - position: relative; - padding-left: 8px; - padding-right: 8px; - padding-top: 10px; - padding-bottom: 10px; - border-radius: 4px; - opacity: ${({ opacity }) => opacity}; - - transition: all 0.25s; -` -export const PosterWrapper = styled.div` - position: relative; - height: 138px; - width: 246px; - - ${css.media.mobile` - height: 118px; - width: 136px; - `}; -` -export const Poster = styled.img` - height: 100%; - width: 100%; - min-width: 246px; - opacity: ${theme('avatar.opacity')}; - - ${css.media.mobile` - min-width: 146px; -`}; -` -export const Duration = styled.div` - position: absolute; - bottom: 0; - right: 0; - background: #2e2e2f; - color: white; - font-size: 0.8rem; - padding: 0 4px; -` -export const Title = styled.div` - font-size: 1rem; - - &:hover { - cursor: pointer; - } - - @media (max-width: 1450px) { - max-width: 500px; - } - @media (max-width: 1250px) { - max-width: 450px; - } - @media (max-width: 1100px) { - max-width: 350px; - } -` -export const Main = styled.div` - ${css.flexColumnGrow()}; - margin-left: 10px; -` -export const TopHalf = styled.div` - ${css.flex()}; -` -export const SecondHalf = styled.ul` - margin-left: 10px; - margin-top: -10px; - flex-grow: 1; -` -export const Brief = styled.div` - ${css.flexGrow('align-center')}; - margin-left: 10px; - margin-bottom: 10px; - color: ${theme('thread.articleTitle')}; -` -export const ViewInfo = styled.div` - ${css.flex()}; -` -export const ViewIcon = styled(Img)` - fill: ${theme('thread.articleLink')}; - ${css.size(10)}; -` -export const Extra = styled.li` - ${css.flex('align-center')}; - - opacity: 0.8; - transition: opacity 0.2s; - font-size: 0.85rem; - color: ${theme('thread.extraInfo')}; -` -export const BodyDigest = styled.li` - margin-top: 5px; - color: ${theme('thread.articleDigest')}; - margin-right: 20px; - white-space: normal; - display: block; - font-size: 0.85rem; - &:hover { - cursor: pointer; - } - - ${css.media.mobile` - ${css.cutRest('200px')}; - `}; -` -export const OriginalAuthorLink = styled.a` - transition: color 0.3s; - color: ${theme('thread.extraInfo')}; - - &:hover { - cursor: pointer; - color: ${theme('thread.extraInfo')}; - text-decoration: underline; - } -` -export const BottomAuthorWrapper = styled.div` - ${css.flex()}; - margin-left: 10px; - margin-bottom: 2px; -` -export const ButtonAvatar = styled(Img)` - ${css.circle(20)}; - opacity: 0.8; -` -export const ButtonNickname = styled.div` - color: ${theme('thread.articleDigest')}; - margin-left: 5px; -` -export const InsertTime = styled.div` - ${css.flex('align-center')}; - font-size: 0.8rem; - color: ${theme('thread.articleDigest')}; - margin-top: 1px; - margin-left: 2px; -` diff --git a/src/components/VideoItem/tests/index.test.ts b/src/components/VideoItem/tests/index.test.ts deleted file mode 100755 index b78db0df3..000000000 --- a/src/components/VideoItem/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoItem from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/components/VideoPoster/index.js b/src/components/VideoPoster/index.js deleted file mode 100755 index 6f6293033..000000000 --- a/src/components/VideoPoster/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * VideoPoster - * - */ - -import React from 'react' -import T from 'prop-types' - -import { ICON_CMD } from '@/config' -import { buildLog } from '@/utils' - -import { Wrapper, PosterImage, PlayIcon } from './styles' - -/* eslint-disable-next-line */ -const log = buildLog('c:VideoPoster:index') - -const VideoPoster = ({ poster }) => ( - - - - -) - -VideoPoster.propTypes = { - poster: T.string.isRequired, -} - -VideoPoster.defaultProps = {} - -export default React.memo(VideoPoster) diff --git a/src/components/VideoPoster/styles/index.js b/src/components/VideoPoster/styles/index.js deleted file mode 100755 index eda5655ad..000000000 --- a/src/components/VideoPoster/styles/index.js +++ /dev/null @@ -1,35 +0,0 @@ -import styled from 'styled-components' - -import { theme, animate, css } from '@/utils' -import Img from '@/Img' - -export const Wrapper = styled.div` - ${css.flex('align-both')}; - - position: relative; - width: 100%; - min-height: 400px; - background: #000000; - &:hover { - cursor: pointer; - } -` -export const PosterImage = styled(Img)` - width: 80%; - height: auto; - max-height: 400px; -` -export const PlayIcon = styled(Img)` - position: absolute; - fill: ${theme('cover')}; - width: 80px; - height: 80px; - top: 35%; - left: 45%; - opacity: 0; - ${Wrapper}:hover & { - animation: ${animate.zoomIn} 0.2s linear; - opacity: 1; - cursor: pointer; - } -` diff --git a/src/components/VideoPoster/tests/index.test.ts b/src/components/VideoPoster/tests/index.test.ts deleted file mode 100755 index d07f63053..000000000 --- a/src/components/VideoPoster/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoPoster from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/components/VideoSourceInfo/index.js b/src/components/VideoSourceInfo/index.js deleted file mode 100755 index 96cfb0603..000000000 --- a/src/components/VideoSourceInfo/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * VideoSourceInfo - * - */ - -import React from 'react' -import T from 'prop-types' -import { contains } from 'ramda' - -import { ICON_CMD } from '@/config' - -import { buildLog } from '@/utils' -import Maybe from '@/components/Maybe' - -import { Wrapper, LinkIcon, LogoIcon, Text } from './styles' - -/* eslint-disable-next-line */ -const log = buildLog('c:VideoSourceInfo:index') - -const recommendSources = ['youtube', 'vimeo', 'bilibili'] -const colorMaps = { - youtube: '#FF0008', - vimeo: '#00B7E7', - bilibili: '#F78199', -} - -const VideoSourceInfo = ({ value }) => ( - - - - - - - - {value} - -) - -VideoSourceInfo.propTypes = { - value: T.string.isRequired, -} - -VideoSourceInfo.defaultProps = {} - -export default React.memo(VideoSourceInfo) diff --git a/src/components/VideoSourceInfo/styles/index.ts b/src/components/VideoSourceInfo/styles/index.ts deleted file mode 100755 index 7d5862f64..000000000 --- a/src/components/VideoSourceInfo/styles/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import styled from 'styled-components' - -import { theme, css } from '@/utils' -import Img from '@/Img' - -export const Wrapper = styled.div` - ${css.flex('align-center')}; - color: ${theme('thread.articleLink')}; - margin-left: 10px; - opacity: 0.8; -` -export const LinkIcon = styled(Img)` - fill: ${theme('thread.articleLink')}; - ${css.size(12)}; - margin-right: 3px; -` -export const LogoIcon = styled(Img)<{ color: string }>` - fill: ${({ color }) => color}; - ${css.size(15)}; - margin-right: 4px; - margin-left: 2px; -` -export const Text = styled.div` - ${css.media.mobile`display: none`}; -` diff --git a/src/components/VideoSourceInfo/tests/index.test.ts b/src/components/VideoSourceInfo/tests/index.test.ts deleted file mode 100755 index 6ec915e27..000000000 --- a/src/components/VideoSourceInfo/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoSourceInfo from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/containers/content/CommunityContent/index.js b/src/containers/content/CommunityContent/index.js index ddf9481c6..a27362bd6 100755 --- a/src/containers/content/CommunityContent/index.js +++ b/src/containers/content/CommunityContent/index.js @@ -11,7 +11,6 @@ import { useDevice } from '@/hooks' import { pluggedIn, buildLog } from '@/utils' import PostsThread from '@/containers//thread/PostsThread' -import VideosThread from '@/containers/thread/VideosThread' import ReposThread from '@/containers/thread/ReposThread' import WikiThread from '@/containers/thread/WikiThread' import JobsThread from '@/containers/thread/JobsThread' @@ -33,9 +32,6 @@ const ComunityContent = ({ curRoute }) => { case ROUTE.USERS: return - case ROUTE.VIDEOS: - return - case ROUTE.JOBS: return diff --git a/src/containers/content/VideoContent/SideCards.js b/src/containers/content/VideoContent/SideCards.js deleted file mode 100755 index b6be0fb19..000000000 --- a/src/containers/content/VideoContent/SideCards.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react' - -import ArticleAuthorCard from '@/containers/unit/ArticleAuthorCard' -import ContentSourceCard from '@/components/ContentSourceCard' - -import { Wrapper } from './styles/side_cards' - -const SideCards = ({ data }) => ( - - - - -) - -export default React.memo(SideCards) diff --git a/src/containers/content/VideoContent/index.js b/src/containers/content/VideoContent/index.js deleted file mode 100755 index 9fde08f7d..000000000 --- a/src/containers/content/VideoContent/index.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * - * VideoContent - * - */ - -import React from 'react' - -import { THREAD } from '@/constant' -import { pluggedIn, buildLog } from '@/utils' - -import ArticleBodyHeader from '@/containers/unit/ArticleBodyHeader' -import Comments from '@/containers/unit/Comments' -import ArticleAuthorCard from '@/containers/unit/ArticleAuthorCard' -import ContentSourceCard from '@/components/ContentSourceCard' - -import Sticky from '@/components/Sticky' -import Maybe from '@/components/Maybe' -import VideoPoster from '@/components/VideoPoster' -import VideoInfoCard from '@/components/VideoInfoCard' - -import SideCards from './SideCards' - -import { - Wrapper, - InnerWrapper, - MainWrapper, - SidebarWrapper, - ArticleWrapper, - BodyHeaderWrapper, - CommentsWrapper, - MobileWrapper, -} from './styles' - -import { useInit } from './logic' - -/* eslint-disable-next-line */ -const log = buildLog('C:VideoContent') - -const VideoContentContainer = ({ videoContent: store }) => { - useInit(store) - - const { curRoute, viewingData } = store - const { mainPath: communityRaw } = curRoute - - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ) -} - -export default pluggedIn(VideoContentContainer) diff --git a/src/containers/content/VideoContent/logic.js b/src/containers/content/VideoContent/logic.js deleted file mode 100755 index 79a49903d..000000000 --- a/src/containers/content/VideoContent/logic.js +++ /dev/null @@ -1,69 +0,0 @@ -import { useEffect } from 'react' - -import { EVENT, ERR } from '@/constant' -import { asyncSuit, buildLog, errRescue } from '@/utils' -import S from './schema' - -/* eslint-disable-next-line */ -const log = buildLog('L:VideoContent') - -const { SR71, $solver, asyncRes, asyncErr } = asyncSuit -const sr71$ = new SR71({ - receive: [EVENT.REFRESH_VIDEOS], -}) - -let sub$ = null -let store = null - -const loadVideo = () => { - const { id } = store.viewingData - sr71$.query(S.video, { id, userHasLogin: store.isLogin }) -} - -// ############################### -// Data & Error handlers -// ############################### - -const DataSolver = [ - { - match: asyncRes('video'), - action: ({ video }) => store.setViewing({ video }), - }, - { - match: asyncRes(EVENT.REFRESH_VIDEOS), - action: () => loadVideo(), - }, -] -const ErrSolver = [ - { - match: asyncErr(ERR.GRAPHQL), - action: () => {}, - }, - { - match: asyncErr(ERR.TIMEOUT), - action: ({ details }) => - errRescue({ type: ERR.TIMEOUT, details, path: 'VideoContent' }), - }, - { - match: asyncErr(ERR.NETWORK), - action: () => errRescue({ type: ERR.NETWORK, path: 'VideoContent' }), - }, -] - -export const holder = 1 - -// ############################### -// init & uninit -// ############################### -export const useInit = (_store) => - useEffect(() => { - store = _store - // log('effect init') - sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver)) - - return () => { - // log('effect uninit') - sr71$.stop() - sub$.unsubscribe() - } - }, [_store]) diff --git a/src/containers/content/VideoContent/schema.ts b/src/containers/content/VideoContent/schema.ts deleted file mode 100755 index 28a79bf87..000000000 --- a/src/containers/content/VideoContent/schema.ts +++ /dev/null @@ -1,11 +0,0 @@ -import gql from 'graphql-tag' -import { P } from '@/schemas' - -const video = gql` - ${P.video} -` -const schema = { - video, -} - -export default schema diff --git a/src/containers/content/VideoContent/store.js b/src/containers/content/VideoContent/store.js deleted file mode 100755 index 4ef4e093b..000000000 --- a/src/containers/content/VideoContent/store.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * VideoContent store - * - */ - -import { types as T, getParent } from 'mobx-state-tree' - -import { markStates, buildLog } from '@/utils' - -/* eslint-disable-next-line */ -const log = buildLog('S:VideoContent') - -const VideoContent = T.model('VideoContent', {}) - .views((self) => ({ - get root() { - return getParent(self) - }, - get curRoute() { - return self.root.curRoute - }, - get isLogin() { - return self.root.account.isLogin - }, - get viewingData() { - return self.root.viewingData - }, - })) - .actions((self) => ({ - setViewing(sobj) { - self.root.setViewing(sobj) - }, - mark(sobj) { - markStates(sobj, self) - }, - })) - -export default VideoContent diff --git a/src/containers/content/VideoContent/styles/index.ts b/src/containers/content/VideoContent/styles/index.ts deleted file mode 100755 index ca8a1e865..000000000 --- a/src/containers/content/VideoContent/styles/index.ts +++ /dev/null @@ -1,70 +0,0 @@ -import styled from 'styled-components' - -import { theme, css, WIDTH } from '@/utils' - -export const Wrapper = styled.article` - ${css.flexGrow('justify-center')}; - padding: 20px; - min-height: 300px; - ${css.media.tablet` - padding: 8px 0; - `}; -` -export const InnerWrapper = styled.div` - ${css.flex()}; - width: 100%; - max-width: ${WIDTH.ARTICLE.PAGE}; - padding: 0 6vw; - ${css.media.desktop` - padding: 0 4vw; - `}; -` -export const MainWrapper = styled.div` - flex-grow: 1; - ${css.media.tablet` - width: 100%; - `}; -` -export const SidebarWrapper = styled.div` - min-width: 250px; - ${css.media.mobile` - display: none; - `}; -` -export const ArticleWrapper = styled.div` - font-size: 1.1rem; - margin-right: 1.6vw; - background: ${theme('drawer.articleBg')}; - border-radius: 5px; - padding-top: 30px; - min-height: 40vh; - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); - ${css.media.tablet` - padding: 30px 20px; - margin-right: 0; - `}; -` -export const BodyHeaderWrapper = styled.div` - margin-top: -18px; - margin-bottom: 5px; - padding-left: 20px; -` - -export const CommentsWrapper = styled.div` - margin-top: 30px; - margin: 25px; - ${css.media.tablet` - margin: 5px; - `}; -` - -export const MobileWrapper = styled.div` - ${css.flex()}; - margin-top: 15px; - width: 100%; - display: none; - - ${css.media.tablet` - ${css.flex('justify-center')} - `}; -` diff --git a/src/containers/content/VideoContent/styles/side_cards.ts b/src/containers/content/VideoContent/styles/side_cards.ts deleted file mode 100755 index 6b2e15402..000000000 --- a/src/containers/content/VideoContent/styles/side_cards.ts +++ /dev/null @@ -1,11 +0,0 @@ -import styled from 'styled-components' - -// import { theme } from '@/utils' -import { css } from '@/utils' - -export const Wrapper = styled.div` - ${css.flexColumn()}; - min-width: 250px; - ${css.media.tablet`display: none`}; -` -export const holder = 1 diff --git a/src/containers/content/VideoContent/tests/index.test.ts b/src/containers/content/VideoContent/tests/index.test.ts deleted file mode 100755 index 95c11eed4..000000000 --- a/src/containers/content/VideoContent/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoContent from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/containers/content/VideoContent/tests/store.test.ts b/src/containers/content/VideoContent/tests/store.test.ts deleted file mode 100755 index 7c2e8ac79..000000000 --- a/src/containers/content/VideoContent/tests/store.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * VideoContent store test - * - */ - -// import VideoContent from '../index' - -it('TODO: store test VideoContent', () => { - expect(1 + 1).toBe(2) -}) diff --git a/src/containers/digest/ArticleDigest/logic.ts b/src/containers/digest/ArticleDigest/logic.ts index 4c5b699f7..97a69ead0 100755 --- a/src/containers/digest/ArticleDigest/logic.ts +++ b/src/containers/digest/ArticleDigest/logic.ts @@ -62,9 +62,6 @@ const afterReaction = (id) => { case THREAD.JOB: return sr71$.query(S.job, { id }) - case THREAD.VIDEO: - return sr71$.query(S.video, { id }) - case THREAD.REPO: return sr71$.query(S.repo, { id }) @@ -96,14 +93,6 @@ const DataSolver = [ markLoading(false) }, }, - { - match: asyncRes('video'), - action: ({ video }) => { - markLoading(false) - store.setViewing({ video: merge(store.viewingArticle, video) }) - // store.syncViewingItem(video) - }, - }, { match: asyncRes('repo'), action: ({ repo }) => { diff --git a/src/containers/digest/ArticleDigest/schema.ts b/src/containers/digest/ArticleDigest/schema.ts index 9e9ab5b26..05afbf00b 100755 --- a/src/containers/digest/ArticleDigest/schema.ts +++ b/src/containers/digest/ArticleDigest/schema.ts @@ -31,18 +31,6 @@ const job = gql` } } ` -const video = gql` - query($id: ID!) { - video(id: $id) { - id - favoritedCount - starredCount - viewerHasFavorited - viewerHasStarred - favoritedCategoryId - } - } -` const repo = gql` query($id: ID!) { repo(id: $id) { @@ -59,7 +47,6 @@ const schema = { undoReaction, post, job, - video, repo, } diff --git a/src/containers/editor/JobEditor/MarkDownHelper.js b/src/containers/editor/JobEditor/MarkDownHelper.js index 51ddb0d06..b14a60355 100755 --- a/src/containers/editor/JobEditor/MarkDownHelper.js +++ b/src/containers/editor/JobEditor/MarkDownHelper.js @@ -3,15 +3,12 @@ import { Remarkable } from 'remarkable' import remarkableemoj from 'remarkable-emoji' import mentions from 'remarkable-mentions' import Prism from 'mastani-codehighlight' -import { filter, keys } from 'ramda' import { MENTION_USER_ADDR } from '@/config' -import { uid } from '@/utils' import MarkDownStyle from '@/containers/layout/ThemePalette/MarkDownStyle' -import fullEmojis from './emojis' -import { Wrapper, EmojiWrapper, EmojiItem } from './styles/markdown_helper' +import { Wrapper } from './styles/markdown_helper' const md = new Remarkable() md.use(mentions({ url: MENTION_USER_ADDR })) @@ -19,35 +16,6 @@ md.use(remarkableemoj) const notTooLong = (l) => l.length < 20 -/* eslint-disable react/no-danger */ -const Emojis = () => { - const source = filter(notTooLong, keys(fullEmojis)) - - return ( - - -
- {source.map((item) => ( - - ))} -
-
-
- ) -} - const MarkDownInfo = () => { const IntroMD = `\`说明\`: 显示效果与下方实现代码一一对应 # 这是一级标题 @@ -131,7 +99,6 @@ class MarkDownHelper extends React.Component { - ) diff --git a/src/containers/editor/PostEditor/MarkDownHelper.js b/src/containers/editor/PostEditor/MarkDownHelper.js index e4f577320..13c5ee868 100755 --- a/src/containers/editor/PostEditor/MarkDownHelper.js +++ b/src/containers/editor/PostEditor/MarkDownHelper.js @@ -3,50 +3,16 @@ import { Remarkable } from 'remarkable' import remarkableemoj from 'remarkable-emoji' import mentions from 'remarkable-mentions' import Prism from 'mastani-codehighlight' -import { filter, keys } from 'ramda' import { MENTION_USER_ADDR } from '@/config' -import { uid } from '@/utils' import MarkDownStyle from '@/containers/layout/ThemePalette/MarkDownStyle' -import fullEmojis from './emojis' -import { Wrapper, EmojiWrapper, EmojiItem } from './styles/markdown_helper' +import { Wrapper } from './styles/markdown_helper' const md = new Remarkable() md.use(mentions({ url: MENTION_USER_ADDR })) md.use(remarkableemoj) -const notTooLong = (l) => l.length < 20 - -/* eslint-disable react/no-danger */ -const Emojis = () => { - const source = filter(notTooLong, keys(fullEmojis)) - - return ( - - -
- {source.map((item) => ( - - ))} -
-
-
- ) -} - const MarkDownInfo = () => { const IntroMD = `\`说明\`: 显示效果与下方实现代码一一对应 # 这是一级标题 @@ -130,7 +96,6 @@ class MarkDownHelper extends React.Component { - ) diff --git a/src/containers/editor/PostEditor/emojis.js b/src/containers/editor/PostEditor/emojis.js deleted file mode 100755 index a1332f30a..000000000 --- a/src/containers/editor/PostEditor/emojis.js +++ /dev/null @@ -1,904 +0,0 @@ -module.exports = { - ':alarm_clock:': '\u23F0', - ':anchor:': '\u2693', - ':aquarius:': '\u2652', - ':aries:': '\u2648', - ':arrow_backward:': '\u25C0', - ':arrow_double_down:': '\u23EC', - ':arrow_double_up:': '\u23EB', - ':arrow_down:': '\u2B07', - ':arrow_forward:': '\u25B6', - ':arrow_heading_down:': '\u2935', - ':arrow_heading_up:': '\u2934', - ':arrow_left:': '\u2B05', - ':arrow_lower_left:': '\u2199', - ':arrow_lower_right:': '\u2198', - ':arrow_right:': '\u27A1', - ':arrow_right_hook:': '\u21AA', - ':arrow_up:': '\u2B06', - ':arrow_up_down:': '\u2195', - ':arrow_upper_left:': '\u2196', - ':arrow_upper_right:': '\u2197', - ':ballot_box_with_check:': '\u2611', - ':bangbang:': '\u203C', - ':cancer:': '\u264B', - ':baseball:': '\u26BE', - ':black_large_square:': '\u2B1B', - ':black_medium_small_square:': '\u25FE', - ':black_medium_square:': '\u25FC', - ':black_nib:': '\u2712', - ':black_small_square:': '\u25AA', - ':black_circle:': '\u26AB', - ':boat:': '\u26F5', - ':capricorn:': '\u2651', - ':church:': '\u26EA', - ':cloud:': '\u2601', - ':clubs:': '\u2663', - ':coffee:': '\u2615', - ':congratulations:': '\u3297', - ':copyright:': '\u00A9', - ':curly_loop:': '\u27B0', - ':eight_pointed_black_star:': '\u2734', - ':eight_spoked_asterisk:': '\u2733', - ':diamonds:': '\u2666', - ':email:': '\u2709', - ':envelope:': '\u2709', - ':exclamation:': '\u2757', - ':fast_forward:': '\u23E9', - ':fist:': '\u270A', - ':fountain:': '\u26F2', - ':fuelpump:': '\u26FD', - ':gemini:': '\u264A', - ':golf:': '\u26F3', - ':grey_exclamation:': '\u2755', - ':grey_question:': '\u2754', - ':hand:': '\u270B', - ':heart:': '\u2764', - ':hearts:': '\u2665', - ':heavy_check_mark:': '\u2714', - ':heavy_division_sign:': '\u2797', - ':heavy_exclamation_mark:': '\u2757', - ':heavy_minus_sign:': '\u2796', - ':heavy_multiplication_x:': '\u2716', - ':heavy_plus_sign:': '\u2795', - ':hotsprings:': '\u2668', - ':hourglass:': '\u231B', - ':hourglass_flowing_sand:': '\u23F3', - ':information_source:': '\u2139', - ':interrobang:': '\u2049', - ':left_right_arrow:': '\u2194', - ':leftwards_arrow_with_hook:': '\u21A9', - ':leo:': '\u264C', - ':libra:': '\u264E', - ':loop:': '\u27BF', - ':m:': '\u24C2', - ':negative_squared_cross_mark:': '\u274E', - ':no_entry:': '\u26D4', - ':o:': '\u2B55', - ':ophiuchus:': '\u26CE', - ':part_alternation_mark:': '\u303D', - ':partly_sunny:': '\u26C5', - ':pencil2:': '\u270F', - ':phone:': '\u260E', - ':pisces:': '\u2653', - ':point_up:': '\u261D', - ':question:': '\u2753', - ':raised_hand:': '\u270B', - ':recycle:': '\u267B', - ':registered:': '\u00AE', - ':relaxed:': '\u263A', - ':rewind:': '\u23EA', - ':sagittarius:': '\u2650', - ':sailboat:': '\u26F5', - ':scissors:': '\u2702', - ':scorpius:': '\u264F', - ':secret:': '\u3299', - ':snowflake:': '\u2744', - ':snowman:': '\u26C4', - ':soccer:': '\u26BD', - ':spades:': '\u2660', - ':sparkle:': '\u2747', - ':sparkles:': '\u2728', - ':star:': '\u2B50', - ':sunny:': '\u2600', - ':taurus:': '\u2649', - ':telephone:': '\u260E', - ':tent:': '\u26FA', - ':tm:': '\u2122', - ':umbrella:': '\u2614', - ':v:': '\u270C', - ':virgo:': '\u264D', - ':warning:': '\u26A0', - ':watch:': '\u231A', - ':wavy_dash:': '\u3030', - ':wheelchair:': '\u267F', - ':white_check_mark:': '\u2705', - ':white_circle:': '\u26AA', - ':white_large_square:': '\u2B1C', - ':white_medium_small_square:': '\u25FD', - ':white_medium_square:': '\u25FB', - ':white_small_square:': '\u25AB', - ':x:': '\u274C', - ':zap:': '\u26A1', - ':airplane:': '\u2708', - ':+1:': '👍', - ':-1:': '👎', - ':100:': '💯', - ':1234:': '🔢', - ':8ball:': '🎱', - ':a:': '🅰', - ':ab:': '🆎', - ':abc:': '🔤', - ':abcd:': '🔡', - ':accept:': '🉑', - ':aerial_tramway:': '🚡', - ':alien:': '👽', - ':ambulance:': '🚑', - ':angel:': '👼', - ':anger:': '💢', - ':angry:': '😠', - ':-||': '😠', - ':@': '😠', - '>:(': '😠', - ':anguished:': '😧', - ':ant:': '🐜', - ':apple:': '🍎', - ':arrow_down_small:': '🔽', - ':arrow_up_small:': '🔼', - ':arrows_clockwise:': '🔃', - ':arrows_counterclockwise:': '🔄', - ':art:': '🎨', - ':articulated_lorry:': '🚛', - ':astonished:': '😲', - ':athletic_shoe:': '👟', - ':atm:': '🏧', - ':b:': '🅱', - ':baby:': '👶', - ':baby_bottle:': '🍼', - ':baby_chick:': '🐤', - ':baby_symbol:': '🚼', - ':back:': '🔙', - ':baggage_claim:': '🛄', - ':balloon:': '🎈', - ':bamboo:': '🎍', - ':banana:': '🍌', - ':bank:': '🏦', - ':bar_chart:': '📊', - ':barber:': '💈', - ':basketball:': '🏀', - ':bath:': '🛀', - ':bathtub:': '🛁', - ':battery:': '🔋', - ':bear:': '🐻', - ':bee:': '🐝', - ':beer:': '🍺', - ':beers:': '🍻', - ':beetle:': '🐞', - ':beginner:': '🔰', - ':bell:': '🔔', - ':bento:': '🍱', - ':bicyclist:': '🚴', - ':bike:': '🚲', - ':bikini:': '👙', - ':bird:': '🐦', - ':birthday:': '🎂', - ':black_joker:': '🃏', - ':black_square_button:': '🔲', - ':blossom:': '🌼', - ':blowfish:': '🐡', - ':blue_book:': '📘', - ':blue_car:': '🚙', - ':blue_heart:': '💙', - ':blush:': '😊', - ':$': '😊', - ':boar:': '🐗', - ':bomb:': '💣', - ':book:': '📖', - ':bookmark:': '🔖', - ':bookmark_tabs:': '📑', - ':books:': '📚', - ':boom:': '💥', - ':boot:': '👢', - ':bouquet:': '💐', - ':bow:': '🙇', - ':bowling:': '🎳', - ':boy:': '👦', - ':bread:': '🍞', - ':bride_with_veil:': '👰', - ':bridge_at_night:': '🌉', - ':briefcase:': '💼', - ':broken_heart:': '💔', - ':bug:': '🐛', - ':bulb:': '💡', - ':bullettrain_front:': '🚅', - ':bullettrain_side:': '🚄', - ':bus:': '🚌', - ':busstop:': '🚏', - ':bust_in_silhouette:': '👤', - ':busts_in_silhouette:': '👥', - ':cactus:': '🌵', - ':cake:': '🍰', - ':calendar:': '📆', - ':calling:': '📲', - ':camel:': '🐫', - ':camera:': '📷', - ':candy:': '🍬', - ':capital_abcd:': '🔠', - ':car:': '🚗', - ':card_index:': '📇', - ':carousel_horse:': '🎠', - ':cat:': '🐱', - ':cat2:': '🐈', - ':cd:': '💿', - ':chart:': '💹', - ':chart_with_downwards_trend:': '📉', - ':chart_with_upwards_trend:': '📈', - ':checkered_flag:': '🏁', - ':cherries:': '🍒', - ':cherry_blossom:': '🌸', - ':chestnut:': '🌰', - ':chicken:': '🐔', - ':children_crossing:': '🚸', - ':chocolate_bar:': '🍫', - ':christmas_tree:': '🎄', - ':cinema:': '🎦', - ':circus_tent:': '🎪', - ':city_sunrise:': '🌇', - ':city_sunset:': '🌆', - ':cl:': '🆑', - ':clap:': '👏', - ':clapper:': '🎬', - ':clipboard:': '📋', - ':clock1:': '🕐', - ':clock10:': '🕙', - ':clock1030:': '🕥', - ':clock11:': '🕚', - ':clock1130:': '🕦', - ':clock12:': '🕛', - ':clock1230:': '🕧', - ':clock130:': '🕜', - ':clock2:': '🕑', - ':clock230:': '🕝', - ':clock3:': '🕒', - ':clock330:': '🕞', - ':clock4:': '🕓', - ':clock430:': '🕟', - ':clock5:': '🕔', - ':clock530:': '🕠', - ':clock6:': '🕕', - ':clock630:': '🕡', - ':clock7:': '🕖', - ':clock730:': '🕢', - ':clock8:': '🕗', - ':clock830:': '🕣', - ':clock9:': '🕘', - ':clock930:': '🕤', - ':closed_book:': '📕', - ':closed_lock_with_key:': '🔐', - ':closed_umbrella:': '🌂', - ':cocktail:': '🍸', - ':cold_sweat:': '😰', - ':collision:': '💥', - ':computer:': '💻', - ':confetti_ball:': '🎊', - ':confounded:': '😖', - ':confused:': '😕', - '%-)': '😕', - '%)': '😕', - ':construction:': '🚧', - ':construction_worker:': '👷', - ':convenience_store:': '🏪', - ':cookie:': '🍪', - ':cool:': '🆒', - ':cop:': '👮', - ':corn:': '🌽', - ':couple:': '👫', - ':couple_with_heart:': '💑', - ':couplekiss:': '💏', - ':cow:': '🐮', - ':cow2:': '🐄', - ':credit_card:': '💳', - ':crocodile:': '🐊', - ':crossed_flags:': '🎌', - ':crown:': '👑', - ':cry:': '😢', - ":'(": '😢', - ":-'(": '😢', - ':crying_cat_face:': '😿', - ':crystal_ball:': '🔮', - ':cupid:': '💘', - ':currency_exchange:': '💱', - ':curry:': '🍛', - ':custard:': '🍮', - ':customs:': '🛃', - ':cyclone:': '🌀', - ':dancer:': '💃', - ':dancers:': '👯', - ':dango:': '🍡', - ':dart:': '🎯', - ':dash:': '💨', - ':date:': '📅', - ':deciduous_tree:': '🌳', - ':department_store:': '🏬', - ':diamond_shape_with_a_dot_inside:': '💠', - ':disappointed:': '😞', - ':disappointed_relieved:': '😥', - ':dizzy:': '💫', - ':dizzy_face:': '😵', - ':do_not_litter:': '🚯', - ':dog:': '🐶', - ':dog2:': '🐕', - ':dollar:': '💵', - ':dolls:': '🎎', - ':dolphin:': '🐬', - ':door:': '🚪', - ':doughnut:': '🍩', - ':dragon:': '🐉', - ':dragon_face:': '🐲', - ':dress:': '👗', - ':dromedary_camel:': '🐪', - ':droplet:': '💧', - ':dvd:': '📀', - ':e-mail:': '📧', - ':ear:': '👂', - ':ear_of_rice:': '🌾', - ':earth_africa:': '🌍', - ':earth_americas:': '🌎', - ':earth_asia:': '🌏', - ':egg:': '🍳', - ':eggplant:': '🍆', - ':electric_plug:': '🔌', - ':elephant:': '🐘', - ':end:': '🔚', - ':envelope_with_arrow:': '📩', - ':euro:': '💶', - ':european_castle:': '🏰', - ':european_post_office:': '🏤', - ':evergreen_tree:': '🌲', - ':expressionless:': '😑', - ':eyeglasses:': '👓', - ':eyes:': '👀', - ':facepunch:': '👊', - ':factory:': '🏭', - ':fallen_leaf:': '🍂', - ':family:': '👪', - ':fax:': '📠', - ':fearful:': '😨', - ':feet:': '🐾', - ':ferris_wheel:': '🎡', - ':file_folder:': '📁', - ':fire:': '🔥', - ':fire_engine:': '🚒', - ':fireworks:': '🎆', - ':first_quarter_moon:': '🌓', - ':first_quarter_moon_with_face:': '🌛', - ':fish:': '🐟', - ':fish_cake:': '🍥', - ':fishing_pole_and_fish:': '🎣', - ':flags:': '🎏', - ':flashlight:': '🔦', - ':floppy_disk:': '💾', - ':flower_playing_cards:': '🎴', - ':flushed:': '😳', - ':foggy:': '🌁', - ':football:': '🏈', - ':footprints:': '👣', - ':fork_and_knife:': '🍴', - ':four_leaf_clover:': '🍀', - ':free:': '🆓', - ':fried_shrimp:': '🍤', - ':fries:': '🍟', - ':frog:': '🐸', - ':frowning:': '😦', - ':(': '😦', - ':-(': '😦', - ':-[': '😦', - ':[': '😦', - ':full_moon:': '🌕', - ':full_moon_with_face:': '🌝', - ':game_die:': '🎲', - ':gem:': '💎', - ':ghost:': '👻', - ':gift:': '🎁', - ':gift_heart:': '💝', - ':girl:': '👧', - ':globe_with_meridians:': '🌐', - ':goat:': '🐐', - ':grapes:': '🍇', - ':green_apple:': '🍏', - ':green_book:': '📗', - ':green_heart:': '💚', - ':grimacing:': '😬', - ':grin:': '😁', - xD: '😁', - 'x-D': '😁', - XD: '😁', - 'X-D': '😁', - ':grinning:': '😀', - ':guardsman:': '💂', - ':guitar:': '🎸', - ':gun:': '🔫', - ':haircut:': '💇', - ':hamburger:': '🍔', - ':hammer:': '🔨', - ':hamster:': '🐹', - ':handbag:': '👜', - ':hankey:': '💩', - ':hatched_chick:': '🐥', - ':hatching_chick:': '🐣', - ':headphones:': '🎧', - ':hear_no_evil:': '🙉', - ':heart_decoration:': '💟', - ':heart_eyes:': '😍', - ':heart_eyes_cat:': '😻', - ':heartbeat:': '💓', - ':heartpulse:': '💗', - ':heavy_dollar_sign:': '💲', - ':helicopter:': '🚁', - ':herb:': '🌿', - ':hibiscus:': '🌺', - ':high_brightness:': '🔆', - ':high_heel:': '👠', - ':hocho:': '🔪', - ':honey_pot:': '🍯', - ':honeybee:': '🐝', - ':horse:': '🐴', - ':horse_racing:': '🏇', - ':hospital:': '🏥', - ':hotel:': '🏨', - ':house:': '🏠', - ':house_with_garden:': '🏡', - ':hushed:': '😯', - ':ice_cream:': '🍨', - ':icecream:': '🍦', - ':id:': '🆔', - ':ideograph_advantage:': '🉐', - ':imp:': '👿', - ':inbox_tray:': '📥', - ':incoming_envelope:': '📨', - ':information_desk_person:': '💁', - ':innocent:': '😇', - ':halo:': '😇', - '0:-)': '😇', - '0:)': '😇', - '0:3': '😇', - '0:-3': '😇', - ':iphone:': '📱', - ':izakaya_lantern:': '🏮', - ':jack_o_lantern:': '🎃', - ':japan:': '🗾', - ':japanese_castle:': '🏯', - ':japanese_goblin:': '👺', - ':japanese_ogre:': '👹', - ':jeans:': '👖', - ':joy:': '😂', - ':joy_cat:': '😹', - ':key:': '🔑', - ':keycap_ten:': '🔟', - ':kimono:': '👘', - ':kiss:': '💋', - ':kissing:': '😗', - ':*': '😗', - ':^*': '😗', - ':kissing_cat:': '😽', - ':kissing_closed_eyes:': '😚', - ':kissing_heart:': '😘', - ':kissing_smiling_eyes:': '😙', - ':koala:': '🐨', - ':koko:': '🈁', - ':large_blue_circle:': '🔵', - ':large_blue_diamond:': '🔷', - ':large_orange_diamond:': '🔶', - ':last_quarter_moon:': '🌗', - ':last_quarter_moon_with_face:': '🌜', - ':laughing:': '😆', - ':laugh:': '😆', - ':-D': '😆', - ':D': '😆', - ':leaves:': '🍃', - ':ledger:': '📒', - ':left_luggage:': '🛅', - ':lemon:': '🍋', - ':leopard:': '🐆', - ':light_rail:': '🚈', - ':link:': '🔗', - ':lips:': '👄', - ':lipstick:': '💄', - ':lock:': '🔒', - ':lock_with_ink_pen:': '🔏', - ':lollipop:': '🍭', - ':loudspeaker:': '📢', - ':love_hotel:': '🏩', - ':love_letter:': '💌', - ':low_brightness:': '🔅', - ':mag:': '🔍', - ':mag_right:': '🔎', - ':mahjong:': '🀄', - ':mailbox:': '📫', - ':mailbox_closed:': '📪', - ':mailbox_with_mail:': '📬', - ':mailbox_with_no_mail:': '📭', - ':man:': '👨', - ':man_with_gua_pi_mao:': '👲', - ':man_with_turban:': '👳', - ':mans_shoe:': '👞', - ':maple_leaf:': '🍁', - ':mask:': '😷', - ':massage:': '💆', - ':meat_on_bone:': '🍖', - ':mega:': '📣', - ':melon:': '🍈', - ':memo:': '📝', - ':mens:': '🚹', - ':metro:': '🚇', - ':microphone:': '🎤', - ':microscope:': '🔬', - ':milky_way:': '🌌', - ':minibus:': '🚐', - ':minidisc:': '💽', - ':mobile_phone_off:': '📴', - ':money_with_wings:': '💸', - ':moneybag:': '💰', - ':monkey:': '🐒', - ':monkey_face:': '🐵', - ':monorail:': '🚝', - ':moon:': '🌙', - ':mortar_board:': '🎓', - ':mount_fuji:': '🗻', - ':mountain_bicyclist:': '🚵', - ':mountain_cableway:': '🚠', - ':mountain_railway:': '🚞', - ':mouse:': '🐭', - ':mouse2:': '🐁', - ':movie_camera:': '🎥', - ':moyai:': '🗿', - ':muscle:': '💪', - ':mushroom:': '🍄', - ':musical_keyboard:': '🎹', - ':musical_note:': '🎵', - ':musical_score:': '🎼', - ':mute:': '🔇', - ':nail_care:': '💅', - ':name_badge:': '📛', - ':necktie:': '👔', - ':neutral_face:': '😐', - ':|': '😐', - ':-|': '😐', - ':new:': '🆕', - ':new_moon:': '🌑', - ':new_moon_with_face:': '🌚', - ':newspaper:': '📰', - ':ng:': '🆖', - ':no_bell:': '🔕', - ':no_bicycles:': '🚳', - ':no_entry_sign:': '🚫', - ':no_good:': '🙅', - ':no_mobile_phones:': '📵', - ':no_mouth:': '😶', - ':no_pedestrians:': '🚷', - ':no_smoking:': '🚭', - ':non-potable_water:': '🚱', - ':nose:': '👃', - ':notebook:': '📓', - ':notebook_with_decorative_cover:': '📔', - ':notes:': '🎶', - ':nut_and_bolt:': '🔩', - ':o2:': '🅾', - ':ocean:': '🌊', - ':octopus:': '🐙', - ':oden:': '🍢', - ':office:': '🏢', - ':ok:': '🆗', - ':ok_hand:': '👌', - ':ok_woman:': '🙆', - ':older_man:': '👴', - ':older_woman:': '👵', - ':on:': '🔛', - ':oncoming_automobile:': '🚘', - ':oncoming_bus:': '🚍', - ':oncoming_police_car:': '🚔', - ':oncoming_taxi:': '🚖', - ':open_book:': '📖', - ':open_file_folder:': '📂', - ':open_hands:': '👐', - ':open_mouth:': '😮', - ':O': '😮', - ':-O': '😮', - ':-o': '😮', - ':o': '😮', - ':orange_book:': '📙', - ':outbox_tray:': '📤', - ':ox:': '🐂', - ':package:': '📦', - ':page_facing_up:': '📄', - ':page_with_curl:': '📃', - ':pager:': '📟', - ':palm_tree:': '🌴', - ':panda_face:': '🐼', - ':paperclip:': '📎', - ':parking:': '🅿', - ':passport_control:': '🛂', - ':paw_prints:': '🐾', - ':peach:': '🍑', - ':pear:': '🍐', - ':pencil:': '📝', - ':penguin:': '🐧', - ':pensive:': '😔', - ':performing_arts:': '🎭', - ':persevere:': '😣', - ':person_frowning:': '🙍', - ':person_with_blond_hair:': '👱', - ':person_with_pouting_face:': '🙎', - ':pig:': '🐷', - ':pig2:': '🐖', - ':pig_nose:': '🐽', - ':pill:': '💊', - ':pineapple:': '🍍', - ':pizza:': '🍕', - ':point_down:': '👇', - ':point_left:': '👈', - ':point_right:': '👉', - ':point_up_2:': '👆', - ':police_car:': '🚓', - ':poodle:': '🐩', - ':poop:': '💩', - ':post_office:': '🏣', - ':postal_horn:': '📯', - ':postbox:': '📮', - ':potable_water:': '🚰', - ':pouch:': '👝', - ':poultry_leg:': '🍗', - ':pound:': '💷', - ':pouting_cat:': '😾', - ':pray:': '🙏', - ':princess:': '👸', - ':punch:': '👊', - ':purple_heart:': '💜', - ':purse:': '👛', - ':pushpin:': '📌', - ':put_litter_in_its_place:': '🚮', - ':rabbit:': '🐰', - ':rabbit2:': '🐇', - ':racehorse:': '🐎', - ':radio:': '📻', - ':radio_button:': '🔘', - ':rage:': '😡', - ':railway_car:': '🚃', - ':rainbow:': '🌈', - ':raised_hands:': '🙌', - ':raising_hand:': '🙋', - ':ram:': '🐏', - ':ramen:': '🍜', - ':rat:': '🐀', - ':red_car:': '🚗', - ':red_circle:': '🔴', - ':relieved:': '😌', - ':repeat:': '🔁', - ':repeat_one:': '🔂', - ':restroom:': '🚻', - ':revolving_hearts:': '💞', - ':ribbon:': '🎀', - ':rice:': '🍚', - ':rice_ball:': '🍙', - ':rice_cracker:': '🍘', - ':rice_scene:': '🎑', - ':ring:': '💍', - ':rocket:': '🚀', - ':roller_coaster:': '🎢', - ':rooster:': '🐓', - ':rose:': '🌹', - ':rotating_light:': '🚨', - ':round_pushpin:': '📍', - ':rowboat:': '🚣', - ':rugby_football:': '🏉', - ':runner:': '🏃', - ':running:': '🏃', - ':running_shirt_with_sash:': '🎽', - ':sa:': '🈂', - ':sake:': '🍶', - ':sandal:': '👡', - ':santa:': '🎅', - ':satellite:': '📡', - ':satisfied:': '😆', - ':saxophone:': '🎷', - ':school:': '🏫', - ':school_satchel:': '🎒', - ':scream:': '😱', - ':scream_cat:': '🙀', - ':scroll:': '📜', - ':seat:': '💺', - ':see_no_evil:': '🙈', - ':seedling:': '🌱', - ':shaved_ice:': '🍧', - ':sheep:': '🐑', - ':shell:': '🐚', - ':ship:': '🚢', - ':shirt:': '👕', - ':shit:': '💩', - ':shoe:': '👞', - ':shower:': '🚿', - ':signal_strength:': '📶', - ':six_pointed_star:': '🔯', - ':ski:': '🎿', - ':skull:': '💀', - ':sleeping:': '😴', - ':sleepy:': '😪', - ':slot_machine:': '🎰', - ':small_blue_diamond:': '🔹', - ':small_orange_diamond:': '🔸', - ':small_red_triangle:': '🔺', - ':small_red_triangle_down:': '🔻', - ':smile:': '😄', - ':))': '😄', - ':-))': '😄', - ':smile_cat:': '😸', - ':smiley:': '😃', - ':-)': '😃', - ':)': '😃', - ':]': '😃', - ':o)': '😃', - ':smiley_cat:': '😺', - ':smiling_imp:': '😈', - '}:-)': '😈', - '3:-)': '😈', - '}:)': '😈', - '3:)': '😈', - ':smirk:': '😏', - ':smirk_cat:': '😼', - ':smoking:': '🚬', - ':snail:': '🐌', - ':snake:': '🐍', - ':snowboarder:': '🏂', - ':sob:': '😭', - ':soon:': '🔜', - ':sos:': '🆘', - ':sound:': '🔉', - ':space_invader:': '👾', - ':spaghetti:': '🍝', - ':sparkler:': '🎇', - ':sparkling_heart:': '💖', - ':speak_no_evil:': '🙊', - ':speaker:': '🔊', - ':speech_balloon:': '💬', - ':speedboat:': '🚤', - ':star2:': '🌟', - ':stars:': '🌃', - ':station:': '🚉', - ':statue_of_liberty:': '🗽', - ':steam_locomotive:': '🚂', - ':stew:': '🍲', - ':straight_ruler:': '📏', - ':strawberry:': '🍓', - ':stuck_out_tongue:': '😛', - ':P': '😛', - ':-P': '😛', - ':-p': '😛', - ':p': '😛', - ':stuck_out_tongue_closed_eyes:': '😝', - XP: '😝', - 'X-P': '😝', - xP: '😝', - 'x-P': '😝', - Xp: '😝', - 'X-p': '😝', - ':stuck_out_tongue_winking_eye:': '😜', - ':sun_with_face:': '🌞', - ':sunflower:': '🌻', - ':sunglasses:': '😎', - '8-)': '😎', - '8)': '😎', - ':sunrise:': '🌅', - ':sunrise_over_mountains:': '🌄', - ':surfer:': '🏄', - ':sushi:': '🍣', - ':suspension_railway:': '🚟', - ':sweat:': '😓', - ':sweat_drops:': '💦', - ':sweat_smile:': '😅', - ':sweet_potato:': '🍠', - ':swimmer:': '🏊', - ':symbols:': '🔣', - ':syringe:': '💉', - ':tada:': '🎉', - ':tanabata_tree:': '🎋', - ':tangerine:': '🍊', - ':taxi:': '🚕', - ':tea:': '🍵', - ':telephone_receiver:': '📞', - ':telescope:': '🔭', - ':tennis:': '🎾', - ':thought_balloon:': '💭', - ':thumbsdown:': '👎', - ':thumbsup:': '👍', - ':ticket:': '🎫', - ':tiger:': '🐯', - ':tiger2:': '🐅', - ':tired_face:': '😫', - ':toilet:': '🚽', - ':tokyo_tower:': '🗼', - ':tomato:': '🍅', - ':tongue:': '👅', - ':top:': '🔝', - ':tophat:': '🎩', - ':tractor:': '🚜', - ':traffic_light:': '🚥', - ':train:': '🚃', - ':train2:': '🚆', - ':tram:': '🚊', - ':triangular_flag_on_post:': '🚩', - ':triangular_ruler:': '📐', - ':trident:': '🔱', - ':triumph:': '😤', - ':trolleybus:': '🚎', - ':trophy:': '🏆', - ':tropical_drink:': '🍹', - ':tropical_fish:': '🐠', - ':truck:': '🚚', - ':trumpet:': '🎺', - ':tshirt:': '👕', - ':tulip:': '🌷', - ':turtle:': '🐢', - ':tv:': '📺', - ':twisted_rightwards_arrows:': '🔀', - ':two_hearts:': '💕', - ':two_men_holding_hands:': '👬', - ':two_women_holding_hands:': '👭', - ':u5272:': '🈹', - ':u5408:': '🈴', - ':u55b6:': '🈺', - ':u6307:': '🈯', - ':u6708:': '🈷', - ':u6709:': '🈶', - ':u6e80:': '🈵', - ':u7121:': '🈚', - ':u7533:': '🈸', - ':u7981:': '🈲', - ':u7a7a:': '🈳', - ':unamused:': '😒', - ':\\': '😒', - ':-\\': '😒', - ':-/': '😒', - ':/': '😒', - ':underage:': '🔞', - ':unlock:': '🔓', - ':up:': '🆙', - ':vertical_traffic_light:': '🚦', - ':vhs:': '📼', - ':vibration_mode:': '📳', - ':video_camera:': '📹', - ':video_game:': '🎮', - ':violin:': '🎻', - ':volcano:': '🌋', - ':vs:': '🆚', - ':walking:': '🚶', - ':waning_crescent_moon:': '🌘', - ':waning_gibbous_moon:': '🌖', - ':water_buffalo:': '🐃', - ':watermelon:': '🍉', - ':wave:': '👋', - ':waxing_crescent_moon:': '🌒', - ':waxing_gibbous_moon:': '🌔', - ':wc:': '🚾', - ':weary:': '😩', - ':wedding:': '💒', - ':whale:': '🐳', - ':whale2:': '🐋', - ':white_flower:': '💮', - ':white_square_button:': '🔳', - ':wind_chime:': '🎐', - ':wine_glass:': '🍷', - ':wink:': '😉', - ';)': '😉', - ';-)': '😉', - ':wolf:': '🐺', - ':woman:': '👩', - ':womans_clothes:': '👚', - ':womans_hat:': '👒', - ':womens:': '🚺', - ':worried:': '😟', - ':wrench:': '🔧', - ':yellow_heart:': '💛', - ':yen:': '💴', - ':yum:': '😋', - ':zzz:': '💤', -} diff --git a/src/containers/editor/PostEditor/styles/markdown_helper.ts b/src/containers/editor/PostEditor/styles/markdown_helper.ts index 2e2d2a8f1..cfa39edbc 100755 --- a/src/containers/editor/PostEditor/styles/markdown_helper.ts +++ b/src/containers/editor/PostEditor/styles/markdown_helper.ts @@ -2,15 +2,10 @@ import styled from 'styled-components' import { theme } from '@/utils' -export const EmojiWrapper = styled.div` - margin-top: 18px; -` -export const EmojiItem = styled.div` - width: 200px; -` export const Wrapper = styled.div` background: ${theme('drawer.markdownHelperBg')}; padding: 20px; margin-left: 4%; margin-right: 4%; ` +export const holder = 1 diff --git a/src/containers/editor/VideoEditor/AlertMessage.js b/src/containers/editor/VideoEditor/AlertMessage.js deleted file mode 100755 index 56cfa81ee..000000000 --- a/src/containers/editor/VideoEditor/AlertMessage.js +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react' - -import AlertBar from '@/components/AlertBar' -import { Br } from '@/components/Common' -import { ICON_CMD } from '@/config' - -import { - Wrapper, - WarnMsgWrapper, - WarnMsgItem, - WarnMsgIcon, - WarnMsgText, -} from './styles/alert_message' - -const WarnMessage = () => ( - - - - - 仅限发布公开视频链接,如果您发布的视频内容是需要付费才能观看的,请先获取授权。 - - -
- - - - 如非质量极高,请不要发布广告网站, - 如优酷/土豆,爱奇艺,腾讯视频等站点的内容。推荐 youtube, vimeo, B站 等。 - - -
-) - -const AlertMessage = () => ( - - - - - -) - -export default React.memo(AlertMessage) diff --git a/src/containers/editor/VideoEditor/CoverUploader.js b/src/containers/editor/VideoEditor/CoverUploader.js deleted file mode 100755 index ccc7f9675..000000000 --- a/src/containers/editor/VideoEditor/CoverUploader.js +++ /dev/null @@ -1,79 +0,0 @@ -import React from 'react' - -import { ICON_CMD } from '@/config' -import { nilOrEmpty } from '@/utils' - -import DocUploader from '@/containers/tool/DocUploader' -import Maybe from '@/components/Maybe' - -import { - Wrapper, - Thumbnil, - Poster, - UploaderLabel, - UploaderIcon, - UploaderText, - CoverImg, - ThumbCermeraIcon, - PosterCermeraIcon, -} from './styles/cover_uploader' - -import { inputOnChange, usePosterAsThumbnil } from './logic' - -const CoverUploader = ({ thumbnil, poster }) => ( - - inputOnChange('thumbnil')} - pasteImage={false} - > - {nilOrEmpty(thumbnil) ? ( - - - - 缩略图 - - - ) : ( - - - - - )} - - - {nilOrEmpty(poster) ? ( - - inputOnChange('poster')} - pasteImage={false} - > - - - 上传封面图 - - -
- - - - - 使用缩略图 - - - -
- ) : ( - inputOnChange('poster')} - pasteImage={false} - > - - - - - - )} -
-) - -export default React.memo(CoverUploader) diff --git a/src/containers/editor/VideoEditor/SourceOptions.js b/src/containers/editor/VideoEditor/SourceOptions.js deleted file mode 100755 index d443e99b5..000000000 --- a/src/containers/editor/VideoEditor/SourceOptions.js +++ /dev/null @@ -1,66 +0,0 @@ -import React from 'react' -import { compose, trim, toLower, contains, map, pluck, isEmpty } from 'ramda' - -import { ICON_CMD } from '@/config' -import { Wrapper, ItemWrapper, Title, Icon } from './styles/source_options' - -const recommands = [ - { - title: 'YouTube', - icon: `${ICON_CMD}/youtube.svg`, - activeColor: '#FF0008', - }, - { - title: 'Vimeo', - icon: `${ICON_CMD}/vimeo.svg`, - activeColor: '#00B7E7', - }, - { - title: 'Bilibili', - icon: `${ICON_CMD}/bilibili.svg`, - activeColor: '#F78199', - }, -] - -const other = { - title: 'others', - icon: `${ICON_CMD}/more.svg`, -} - -const trimLower = compose(trim, toLower) - -const SourceOptions = ({ active, sourceOnSelect }) => { - if (!active) active = '' - - const otherOption = - !contains(trimLower(active), map(trimLower, pluck('title', recommands))) && - !isEmpty(active) - - return ( - - {recommands.map((s) => ( - sourceOnSelect(trimLower(s.title))} - > - - - {s.title} - - - ))} - - - - {other.title} - - - - ) -} - -export default React.memo(SourceOptions) diff --git a/src/containers/editor/VideoEditor/index.js b/src/containers/editor/VideoEditor/index.js deleted file mode 100755 index 08763b6b4..000000000 --- a/src/containers/editor/VideoEditor/index.js +++ /dev/null @@ -1,134 +0,0 @@ -/* - * - * VideoEditor - * - */ - -import React from 'react' - -import { pluggedIn, buildLog } from '@/utils' - -import Labeler from '@/containers/unit/Labeler' -import FormItem from '@/components/FormItem' -import ArticleEditFooter from '@/components/ArticleEditFooter' - -import AlertMessage from './AlertMessage' -import CoverUploader from './CoverUploader' -import SourceOptions from './SourceOptions' - -import { Wrapper, Title, FormWrapper } from './styles' -import { useInit, inputOnChange, cancelPublish, onPublish } from './logic' - -/* eslint-disable-next-line */ -const log = buildLog('C:VideoEditor') - -const VideoEditorContainer = ({ videoEditor: store, attachment }) => { - log('VideoEditorContainer come') - useInit(store, attachment) - - const { editVideoData, publishing, ratKey, isEdit } = store - - return ( - - {!isEdit ? 发布视频链接 : 更新视频链接} - - - - inputOnChange('title')} - placeholder="视频标题 #必填#" - /> - inputOnChange('source')} - placeholder="YouTube #必填#" - att={ - inputOnChange('source')} - /> - } - /> - inputOnChange('link')} - placeholder="https://youtube/xxx #必填#" - /> - inputOnChange('originalAuthor')} - placeholder="原视频作者昵称 #必填#" - /> - inputOnChange('originalAuthorLink')} - placeholder="视频网站的作者主页||作者社交账号链接 #必填#" - /> - inputOnChange('duration')} - placeholder="mm:ss 或 hh:mm:ss #必填#" - /> - {!isEdit && ( - inputOnChange('publishAt')} - placeholder="原视频发布日期, 格式 YYYY/MM/DD #必填#" - /> - )} - inputOnChange('desc')} - type="textarea" - placeholder="视频描述信息 #必填#" - /> - {!isEdit && ( - } - /> - )} - - - - - ) -} - -export default pluggedIn(VideoEditorContainer) diff --git a/src/containers/editor/VideoEditor/logic.js b/src/containers/editor/VideoEditor/logic.js deleted file mode 100755 index 3a24bf13c..000000000 --- a/src/containers/editor/VideoEditor/logic.js +++ /dev/null @@ -1,134 +0,0 @@ -import { useEffect } from 'react' -import { merge, isEmpty } from 'ramda' - -import { TYPE, EVENT, ERR } from '@/constant' -import { - asyncSuit, - buildLog, - send, - cast, - updateEditing, - closeDrawer, - errRescue, -} from '@/utils' - -import { S, updatableFields } from './schema' - -/* eslint-disable-next-line */ -const log = buildLog('L:VideoEditor') - -const { SR71, $solver, asyncRes, asyncErr } = asyncSuit -const sr71$ = new SR71() - -let sub$ = null -let store = null - -export const inputOnChange = (part, e) => updateEditing(store, part, e) - -export const onPublish = () => { - if (!store.validator('publish')) return false - - const { isEdit } = store - - const communityId = store.curCommunity.id - const publishAt = new Date(store.editVideoData.publishAt).toISOString() - const durationSec = 2000 - const args = merge(store.editVideoData, { - communityId, - publishAt, - durationSec, - }) - - if (!isEmpty(store.labelsData.tags)) { - args.tags = store.labelsData.tags - } - - store.mark({ publishing: true }) - if (isEdit) { - const args = cast(updatableFields, store.editVideoData) - return sr71$.mutate(S.updateVideo, args) - } - sr71$.mutate(S.createVideo, args) -} - -export const cancelPublish = () => { - store.mark({ publishing: false }) - sr71$.stop() - closeDrawer() -} - -export const usePosterAsThumbnil = () => - store.updateEditing({ poster: store.editVideoData.thumbnil }) - -const cancelLoading = () => store.mark({ publishing: false }) - -// ############################### -// Data & Error handlers -// ############################### -const DataSolver = [ - { - match: asyncRes('createVideo'), - action: () => { - closeDrawer() - send(EVENT.REFRESH_VIDEOS) - store.reset() - }, - }, - { - match: asyncRes('updateVideo'), - action: () => { - closeDrawer() - send(EVENT.REFRESH_VIDEOS) - store.reset() - }, - }, -] - -const ErrSolver = [ - { - match: asyncErr(ERR.GRAPHQL), - action: () => cancelLoading(), - }, - { - match: asyncErr(ERR.TIMEOUT), - action: ({ details }) => { - cancelLoading() - errRescue({ type: ERR.TIMEOUT, details, path: 'VideoEditor' }) - }, - }, - { - match: asyncErr(ERR.NETWORK), - action: () => { - cancelLoading() - errRescue({ type: ERR.NETWORK, path: 'VideoEditor' }) - }, - }, -] - -const openAttachment = (att) => { - if (!att) return false - const { type } = att - if (type === TYPE.DRAWER.VIDEO_EDIT) { - store.mark({ editVideo: att, isEdit: true }) - } -} - -// ############################### -// init & uninit -// ############################### -export const useInit = (_store, attachment) => { - useEffect(() => { - store = _store - // log('effect init') - sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver)) - openAttachment(attachment) - log('啊啊啊') - - return () => { - // log('effect uninit') - store.mark({ isEdit: false, editVideo: { source: 'youtube' } }) - sr71$.stop() - sub$.unsubscribe() - } - }, [_store, attachment]) -} diff --git a/src/containers/editor/VideoEditor/schema.ts b/src/containers/editor/VideoEditor/schema.ts deleted file mode 100755 index bf7b3eef9..000000000 --- a/src/containers/editor/VideoEditor/schema.ts +++ /dev/null @@ -1,91 +0,0 @@ -import gql from 'graphql-tag' - -const createVideo = gql` - mutation( - $title: String! - $poster: String! - $thumbnil: String! - $desc: String! - $duration: String! - $durationSec: Int! - $source: String! - $link: String! - $originalAuthor: String! - $originalAuthorLink: String! - $publishAt: String! - $communityId: ID! - $tags: [Ids] - ) { - createVideo( - title: $title - poster: $poster - thumbnil: $thumbnil - desc: $desc - duration: $duration - durationSec: $durationSec - source: $source - link: $link - originalAuthor: $originalAuthor - originalAuthorLink: $originalAuthorLink - publishAt: $publishAt - communityId: $communityId - tags: $tags - ) { - title - id - } - } -` -const updateVideo = gql` - mutation( - $id: ID! - $title: String - $poster: String - $thumbnil: String - $desc: String - $duration: String - $durationSec: Int - $source: String - $link: String - $originalAuthor: String - $originalAuthorLink: String - $publishAt: String - ) { - updateVideo( - id: $id - title: $title - poster: $poster - thumbnil: $thumbnil - desc: $desc - duration: $duration - durationSec: $durationSec - source: $source - link: $link - originalAuthor: $originalAuthor - originalAuthorLink: $originalAuthorLink - publishAt: $publishAt - ) { - id - title - } - } -` - -export const updatableFields = [ - 'id', - 'title', - 'poster', - 'thumbnil', - 'desc', - 'duration', - 'durationSec', - 'source', - 'link', - 'originalAuthor', - 'originalAuthorLink', -] - -export const S = { - createVideo, - updateVideo, -} diff --git a/src/containers/editor/VideoEditor/store.js b/src/containers/editor/VideoEditor/store.js deleted file mode 100755 index bbdcbf1bf..000000000 --- a/src/containers/editor/VideoEditor/store.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - * VideoEditor store - * - */ - -import { types as T, getParent } from 'mobx-state-tree' -import { merge } from 'ramda' - -import { markStates, buildLog, stripMobx, changeset, flashState } from '@/utils' -import { Video } from '@/model' - -/* eslint-disable-next-line */ -const log = buildLog('S:VideoEditor') - -const VideoEditor = T.model('VideoEditor', { - editVideo: T.optional(Video, { source: 'youtube' }), - isEdit: T.optional(T.boolean, false), - publishing: T.optional(T.boolean, false), - - ratKey: T.optional(T.string, ''), -}) - .views((self) => ({ - get root() { - return getParent(self) - }, - get curCommunity() { - return stripMobx(self.root.viewing.community) - }, - get labelsData() { - return self.root.labeler.labelsData - }, - get editVideoData() { - return { - ...stripMobx(self.editVideo), - } - }, - })) - .actions((self) => ({ - changesetErr(options) { - self.root.changesetErr(options) - }, - updateEditing(sobj) { - const editVideo = merge(self.editVideoData, { ...sobj }) - self.mark({ editVideo }) - }, - validator(type) { - switch (type) { - case 'publish': { - const opt = { msg: '不能为空 (请填写 #必填# 字段)' } - - const result = changeset(self.editVideoData) - .exist({ thumbnil: '缩略图' }, self.changesetErr) - .exist({ thumbnil: '视频封面' }, self.changesetErr) - .exist({ title: '视频标题' }, self.changesetErr, opt) - .min({ title: '视频标题' }, 5, self.changesetErr, opt) - .exist({ source: '视频来源' }, self.changesetErr, opt) - .exist({ link: '视频链接' }, self.changesetErr, opt) - .startsWith({ link: '视频链接' }, 'https://', self.changesetErr) - .exist({ originalAuthor: '原作者昵称' }, self.changesetErr, opt) - .exist({ originalAuthorLink: '原作者链接' }, self.changesetErr, opt) - .startsWith( - { originalAuthorLink: '原作者链接' }, - 'https://', - self.changesetErr, - ) - .exist({ desc: '视频描述' }, self.changesetErr, opt) - .min({ desc: '视频描述' }, 10, self.changesetErr, opt) - .exist({ duration: '时长' }, self.changesetErr, opt) - .durationFmt({ duration: '时长' }, self.changesetErr) - .exist( - { publishAt: '发布日期' }, - self.changesetErr, - merge(opt, { skip: self.isEdit }), - ) - .dateFmt( - { publishAt: '发布日期' }, - self.changesetErr, - merge(opt, { skip: self.isEdit }), - ) - .done() - - // const format1 = /^([01]?[0-9]|[0-5][0-9]):[0-5][0-9]$/ - // const format2 = /^(?:0[0-2]|0[0-9]):[0-5][0-9]:[0-5][0-9]$/ - - if (!result.passed) flashState(self, 'ratKey', result.rat) - return result.passed - } - default: { - return false - } - } - }, - reset() { - self.isEdit = false - self.editVideo = { source: 'youtube' } - self.publishing = false - }, - mark(sobj) { - markStates(sobj, self) - }, - })) - -export default VideoEditor diff --git a/src/containers/editor/VideoEditor/styles/alert_message.ts b/src/containers/editor/VideoEditor/styles/alert_message.ts deleted file mode 100755 index a8f7c5616..000000000 --- a/src/containers/editor/VideoEditor/styles/alert_message.ts +++ /dev/null @@ -1,22 +0,0 @@ -import styled from 'styled-components' - -import Img from '@/Img' -import { theme, css } from '@/utils' - -export const Wrapper = styled.div` - margin-bottom: 20px; -` -export const WarnMsgWrapper = styled.div` - font-size: 0.8rem; -` -export const WarnMsgItem = styled.div` - ${css.flex('align-start')}; -` -export const WarnMsgIcon = styled(Img)` - fill: ${theme('alertWarn.text')}; - ${css.size(16)}; - margin-right: 5px; - margin-top: 2px; - opacity: 0.8; -` -export const WarnMsgText = styled.div`` diff --git a/src/containers/editor/VideoEditor/styles/cover_uploader.ts b/src/containers/editor/VideoEditor/styles/cover_uploader.ts deleted file mode 100755 index b05fac689..000000000 --- a/src/containers/editor/VideoEditor/styles/cover_uploader.ts +++ /dev/null @@ -1,86 +0,0 @@ -import styled from 'styled-components' - -import Img from '@/Img' -import { theme, animate, css } from '@/utils' - -export const Wrapper = styled.div` - ${css.flex('justify-between')}; - - height: 200px; - width: 100%; - margin-bottom: 25px; - padding: 0 10px; -` -export const Thumbnil = styled.div` - ${css.flex('align-both')}; - align-self: center; - - position: relative; - height: 100px; - width: 180px; - border: 1px dashed; - border-color: ${theme('form.label')}; - border-radius: 3px; - &:hover { - cursor: pointer; - } -` -export const Poster = styled.div` - ${css.flexColumnGrow('align-both')}; - height: 200px; - position: relative; - margin-left: 10px; - border: 1px dashed; - border-radius: 3px; - border-color: ${theme('form.label')}; -` -export const UploaderLabel = styled.div` - ${css.flex('align-center')}; - &:hover { - cursor: pointer; - } -` -export const UploaderIcon = styled(Img)` - fill: ${theme('form.label')}; - ${css.size(30)}; - margin-right: 10px; -` -export const UploaderText = styled.div` - color: ${theme('form.label')}; - font-size: 1.2rem; - &:hover { - color: ${theme('banner.title')}; - } -` -export const CoverImg = styled(Img)` - width: 100%; - height: 100%; -` - -export const ThumbCermeraIcon = styled(Img)` - position: absolute; - fill: #f9fcfc; - width: 50px; - height: 50px; - top: 25%; - left: 35%; - opacity: 0; - ${Thumbnil}:hover & { - animation: ${animate.zoomIn} 0.2s linear; - opacity: 1; - } -` -export const PosterCermeraIcon = styled(Img)` - position: absolute; - fill: #f9fcfc; - width: 50px; - height: 50px; - top: 35%; - left: 40%; - opacity: 0; - ${Poster}:hover & { - animation: ${animate.zoomIn} 0.2s linear; - opacity: 1; - cursor: pointer; - } -` diff --git a/src/containers/editor/VideoEditor/styles/index.ts b/src/containers/editor/VideoEditor/styles/index.ts deleted file mode 100755 index 7a754ac28..000000000 --- a/src/containers/editor/VideoEditor/styles/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -import styled from 'styled-components' - -import { theme, css } from '@/utils' - -export const Wrapper = styled.div` - ${css.flexColumn('align-center')}; - position: relative; - padding-top: 20px; - padding-bottom: 50px; - height: auto; - min-height: 80vh; - margin-top: 15px; - margin-left: 15px; - margin-right: 15px; - background: ${theme('content.cardBg')}; - border-radius: 5px; -` -export const Title = styled.h2` - color: ${theme('form.label')}; -` -export const FormWrapper = styled.div` - width: 100%; - padding: 0 30px; -` diff --git a/src/containers/editor/VideoEditor/styles/source_options.ts b/src/containers/editor/VideoEditor/styles/source_options.ts deleted file mode 100755 index f1b3e75a9..000000000 --- a/src/containers/editor/VideoEditor/styles/source_options.ts +++ /dev/null @@ -1,44 +0,0 @@ -import styled from 'styled-components' - -import type { TActive } from '@/spec' -import Img from '@/Img' -import { theme, css } from '@/utils' - -export const Wrapper = styled.div` - ${css.flex('align-center')}; - margin-top: 5px; -` -export const ItemWrapper = styled.div` - ${css.flex('align-center')}; - margin-right: 8px; -` -type TTitle = TActive & { nohover: boolean } -export const Title = styled.div` - color: ${({ active }) => - active ? theme('banner.title') : theme('banner.desc')}; - cursor: ${({ nohover }) => (nohover ? '' : 'pointer')}; - font-size: 0.8rem; -` -type TIcon = TActive & { activeColor: string } -export const Icon = styled(Img)` - fill: ${({ active, activeColor }) => - active ? activeColor || theme('banner.title') : theme('banner.desc')}; - ${css.size(16)}; - display: block; - margin-right: 3px; -` -export const RespectText = styled.div` - color: ${theme('editor.placeholder')}; - display: ${({ show }) => (show ? 'block' : 'none')}; -` -export const Divider = styled.div` - border-top: 1px solid; - border-color: ${theme('editor.placeholder')}; - margin-top: 10px; - width: 55%; - margin-bottom: 20px; -` -export const PublishButtons = styled.div` - width: 50%; - text-align: center; -` diff --git a/src/containers/editor/VideoEditor/tests/index.test.ts b/src/containers/editor/VideoEditor/tests/index.test.ts deleted file mode 100755 index c2781d051..000000000 --- a/src/containers/editor/VideoEditor/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoEditor from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/containers/editor/VideoEditor/tests/store.test.ts b/src/containers/editor/VideoEditor/tests/store.test.ts deleted file mode 100755 index b50110e84..000000000 --- a/src/containers/editor/VideoEditor/tests/store.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * VideoEditor store test - * - */ - -// import VideoEditor from '../index' - -it('TODO: store test VideoEditor', () => { - expect(1 + 1).toBe(2) -}) diff --git a/src/containers/thread/VideosThread/index.js b/src/containers/thread/VideosThread/index.js deleted file mode 100755 index ca79d07b2..000000000 --- a/src/containers/thread/VideosThread/index.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * - * VideosThread - * - */ - -import React from 'react' - -import { ICON_CMD } from '@/config' -import { THREAD } from '@/constant' -import { pluggedIn, buildLog } from '@/utils' - -import TagsBar from '@/containers/unit/TagsBar' - -import Sticky from '@/components/Sticky' -import { PublishButton } from '@/components/Buttons' -import Maybe from '@/components/Maybe' -import PagedContents from '@/components/PagedContents' -import ContentFilter from '@/components/ContentFilter' - -import { - Wrapper, - LeftPart, - RightPart, - FilterWrapper, - PublisherWrapper, -} from './styles' - -import { - useInit, - onFilterSelect, - onPreview, - onContentCreate, - onTagSelect, - onPageChange, -} from './logic' - -/* eslint-disable-next-line */ -const log = buildLog('C:VideosThread') - -const VideosThreadContainer = ({ videosThread }) => { - useInit(videosThread) - - const { - pagedVideosData, - filtersData, - curRoute, - curView, - activeVideo, - activeTagData, - accountInfo, - showFilterBar, - } = videosThread - - const { mainPath } = curRoute - const { totalCount } = pagedVideosData - - return ( - - - - - - - - - - - - - <> - - - - - - - - - - - ) -} - -export default pluggedIn(VideosThreadContainer) diff --git a/src/containers/thread/VideosThread/logic.js b/src/containers/thread/VideosThread/logic.js deleted file mode 100755 index 5531d1e08..000000000 --- a/src/containers/thread/VideosThread/logic.js +++ /dev/null @@ -1,177 +0,0 @@ -import { useEffect } from 'react' -import { pickBy } from 'ramda' - -import { TYPE, EVENT, ERR, THREAD } from '@/constant' -import { - asyncSuit, - buildLog, - scrollToTabber, - send, - notEmpty, - errRescue, -} from '@/utils' - -import S from './schema' - -/* eslint-disable-next-line */ -const log = buildLog('L:VideosThread') - -const { SR71, $solver, asyncRes, asyncErr } = asyncSuit -const sr71$ = new SR71({ - receive: [ - EVENT.REFRESH_VIDEOS, - EVENT.DRAWER.CLOSE, - EVENT.THREAD_CHANGE, - EVENT.C11N_DENSITY_CHANGE, - ], -}) - -let sub$ = null -let store = null - -export const loadVideos = (page = 1) => { - const { curCommunity } = store - const userHasLogin = store.isLogin - - const args = { - filter: { - page, - size: store.pageDensity, - ...store.filtersData, - tag: store.activeTagData.title, - community: curCommunity.raw, - }, - userHasLogin, - } - - args.filter = pickBy(notEmpty, args.filter) - - log('load videos --> ', args) - store.mark({ curView: TYPE.LOADING }) - sr71$.query(S.pagedVideos, args) - store.markRoute({ page, ...store.filtersData }) -} - -export const onPageChange = (page) => { - scrollToTabber() - loadVideos(page) -} - -/** - * preview the current article - * - * @param {*} data {id: string, title: string} - */ -export const onPreview = (data) => { - setTimeout(() => store.setViewedFlag(data.id), 1500) - const type = TYPE.DRAWER.VIDEO_VIEW - const thread = THREAD.VIDEO - - send(EVENT.DRAWER.OPEN, { type, thread, data }) - store.markRoute(data.id) -} - -export const onContentCreate = () => { - if (!store.isLogin) return store.authWarning() - - send(EVENT.DRAWER.OPEN, { type: TYPE.DRAWER.VIDEO_CREATE }) -} - -export const onTagSelect = (tag) => { - store.selectTag(tag) - loadVideos() - store.markRoute({ tag: tag.title }) -} - -export const onFilterSelect = (option) => { - store.selectFilter(option) - store.markRoute({ ...store.filtersData }) - loadVideos() -} - -// ############################### -// Data & Error handlers -// ############################### - -const DataSolver = [ - { - match: asyncRes('pagedVideos'), - action: ({ pagedVideos }) => { - log('========> pagedVideos: ', pagedVideos) - let curView = TYPE.RESULT - if (pagedVideos.entries.length === 0) { - curView = TYPE.RESULT_EMPTY - } - store.mark({ curView, pagedVideos }) - }, - }, - { - match: asyncRes(EVENT.THREAD_CHANGE), - action: (res) => { - const { data } = res[EVENT.THREAD_CHANGE] - const { activeThread } = data - if (activeThread === THREAD.VIDEO) { - store.mark({ activeTag: null }) - return loadVideos() - } - }, - }, - { - match: asyncRes(EVENT.REFRESH_VIDEOS), - action: () => loadVideos(), - }, - { - match: asyncRes(EVENT.C11N_DENSITY_CHANGE), - action: (res) => { - const { type } = res[EVENT.C11N_DENSITY_CHANGE] - if (type === THREAD.VIDEO) loadVideos(store.pagedVideos.pageNumber) - }, - }, - { - match: asyncRes(EVENT.DRAWER.CLOSE), - action: () => { - store.setViewing({ video: {} }) - store.markRoute({ ...store.filtersData, ...store.tagQuery }) - }, - }, - { - match: asyncRes('partialTags'), - action: ({ partialTags: tags }) => store.mark({ tags }), - }, -] - -const ErrSolver = [ - { - match: asyncErr(ERR.GRAPHQL), - action: () => { - // - }, - }, - { - match: asyncErr(ERR.TIMEOUT), - action: ({ details }) => { - errRescue({ type: ERR.TIMEOUT, details, path: 'AccountEditor' }) - }, - }, - { - match: asyncErr(ERR.NETWORK), - action: () => errRescue({ type: ERR.NETWORK, path: 'VideosThread' }), - }, -] - -// ############################### -// init & uninit -// ############################### -export const useInit = (_store) => - useEffect(() => { - store = _store - // log('effect init') - sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver)) - - return () => { - if (store.curView === TYPE.LOADING || !sub$) return false - log('===== do uninit') - sr71$.stop() - sub$.unsubscribe() - } - }, [_store]) diff --git a/src/containers/thread/VideosThread/schema.ts b/src/containers/thread/VideosThread/schema.ts deleted file mode 100755 index bdce96e55..000000000 --- a/src/containers/thread/VideosThread/schema.ts +++ /dev/null @@ -1,13 +0,0 @@ -import gql from 'graphql-tag' -import { P } from '@/schemas' - -const schema = { - pagedVideos: gql` - ${P.pagedVideos} - `, - partialTags: gql` - ${P.partialTags} - `, -} - -export default schema diff --git a/src/containers/thread/VideosThread/store.js b/src/containers/thread/VideosThread/store.js deleted file mode 100755 index 27255cbcc..000000000 --- a/src/containers/thread/VideosThread/store.js +++ /dev/null @@ -1,130 +0,0 @@ -/* - * VideosThread store - * - */ - -import { types as T, getParent } from 'mobx-state-tree' -import { findIndex, merge, propEq, isEmpty, pickBy } from 'ramda' - -import { TYPE, THREAD } from '@/constant' -import { buildLog, markStates, stripMobx, nilOrEmpty, isObject } from '@/utils' -import { PagedVideos, Tag, ContentFilter, emptyPagiData } from '@/model' - -/* eslint-disable-next-line */ -const log = buildLog('S:VideosThread') - -const VideosThread = T.model('VideosThread', { - pagedVideos: T.optional(PagedVideos, emptyPagiData), - filters: T.optional(ContentFilter, {}), - activeTag: T.maybeNull(Tag), - curView: T.optional( - T.enumeration('curView', [ - TYPE.RESULT, - TYPE.LOADING, - TYPE.NOT_FOUND, - TYPE.RESULT_EMPTY, - ]), - TYPE.RESULT, - ), -}) - .views((self) => ({ - get root() { - return getParent(self) - }, - get curRoute() { - return self.root.curRoute - }, - get accountInfo() { - return self.root.account.accountInfo - }, - get isLogin() { - return self.root.account.isLogin - }, - get pagedVideosData() { - return stripMobx(self.pagedVideos) - }, - get curCommunity() { - return stripMobx(self.root.viewing.community) - }, - get filtersData() { - return stripMobx(self.filters) - }, - get activeTagData() { - return stripMobx(self.activeTag) || {} - }, - get tagQuery() { - const curTag = stripMobx(self.activeTag) - if (nilOrEmpty(curTag)) return {} - return { tag: curTag.title } - }, - get activeVideo() { - return stripMobx(self.root.viewing.video) - }, - get pageDensity() { - return self.root.account.pageDensity - }, - get showFilterBar() { - const curFilter = stripMobx(pickBy((v) => !isEmpty(v), self.filters)) - const pagedVideos = stripMobx(self.pagedVideos) - - return !isEmpty(curFilter) || !isEmpty(pagedVideos.entries) - }, - })) - .actions((self) => ({ - authWarning(options) { - self.root.authWarning(options) - }, - selectFilter(option) { - const curfilter = self.filtersData - self.filters = merge(curfilter, option) - }, - selectTag(tag) { - const cur = tag.title === '' ? null : tag - - self.activeTag = cur - }, - showTopModeline(fix) { - self.root.showTopModeline(fix) - }, - setViewing(sobj) { - self.root.setViewing(sobj) - }, - setViewedFlag(id) { - const { entries } = self.pagedVideosData - const index = findIndex(propEq('id', id), entries) - if (index >= 0) { - self.pagedVideos.entries[index].viewerHasViewed = true - } - }, - updateItem(item) { - const { entries } = self.pagedVideosData - const index = findIndex(propEq('id', item.id), entries) - if (index >= 0) { - self.pagedVideos.entries[index] = merge( - stripMobx(self.pagedVideos.entries[index]), - item, - ) - } - }, - updateC11N(option) { - self.root.updateC11N(option) - }, - markRoute(target) { - const query = isObject(target) - ? target - : { - id: target, - preview: THREAD.VIDEO, - community: self.curCommunity.raw, - ...self.tagQuery, - ...self.filtersData, - } - - self.root.markRoute(query, { onlyDesktop: true }) - }, - mark(sobj) { - markStates(sobj, self) - }, - })) - -export default VideosThread diff --git a/src/containers/thread/VideosThread/styles/index.js b/src/containers/thread/VideosThread/styles/index.js deleted file mode 100755 index bc0a2abc9..000000000 --- a/src/containers/thread/VideosThread/styles/index.js +++ /dev/null @@ -1,30 +0,0 @@ -import styled from 'styled-components' -import { css, WIDTH } from '@/utils' - -export const Wrapper = styled.div` - ${css.flex()}; - max-width: ${WIDTH.COMMUNITY.PAGE}; - width: 100%; -` -export const LeftPart = styled.div` - flex-grow: 1; - width: 100%; -` -export const RightPart = styled.div` - min-width: 200px; - margin-left: 30px; - padding-top: 5px; - ${css.media.tablet`display: none;`}; -` - -export const PublisherWrapper = styled.div` - margin-top: 8px; - width: 100%; - max-width: 180px; - margin-left: 8%; -` -export const FilterWrapper = styled.div` - ${css.flex('align-center')}; - margin-bottom: 8px; - margin-left: 8px; -` diff --git a/src/containers/thread/VideosThread/tests/index.test.ts b/src/containers/thread/VideosThread/tests/index.test.ts deleted file mode 100755 index 376abd40c..000000000 --- a/src/containers/thread/VideosThread/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideosThread from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/containers/thread/VideosThread/tests/store.test.ts b/src/containers/thread/VideosThread/tests/store.test.ts deleted file mode 100755 index ecbab8b79..000000000 --- a/src/containers/thread/VideosThread/tests/store.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * VideosThread store test - * - */ - -// import VideosThread from '../index' - -it('TODO: store test VideosThread', () => { - expect(1 + 1).toBe(2) -}) diff --git a/src/containers/tool/C11NSettingPanel/GeneralSettings.js b/src/containers/tool/C11NSettingPanel/GeneralSettings.js index 430ea8608..30112f582 100644 --- a/src/containers/tool/C11NSettingPanel/GeneralSettings.js +++ b/src/containers/tool/C11NSettingPanel/GeneralSettings.js @@ -57,7 +57,7 @@ const GeneralSettings = ({ curThread, customization }) => { 浏览内容时列表的显示方式, 部分板块(如视频,开源项目等)不支持列表视图。 - {!contains(curThread, [THREAD.VIDEO, THREAD.REPO]) ? ( + {!contains(curThread, [THREAD.REPO]) ? ( <>
( > 帖子 - searchThreadOnChange(THREAD.VIDEO)} - active={active === THREAD.VIDEO} - > - 视频 - searchThreadOnChange(THREAD.REPO)} active={active === THREAD.REPO} diff --git a/src/containers/tool/Doraemon/logic/index.js b/src/containers/tool/Doraemon/logic/index.js index a580e6e88..6ec014d18 100755 --- a/src/containers/tool/Doraemon/logic/index.js +++ b/src/containers/tool/Doraemon/logic/index.js @@ -259,23 +259,6 @@ const DataSolver = [ loadSearchSuggestions(data, totalCount) }, }, - { - match: asyncRes('searchVideos'), - action: ({ searchVideos }) => { - const data = map( - (e) => ({ - id: e.id, - logo: e.thumbnil, - raw: `video-raw-${e.id}`, - title: `${e.title} / ${e.source} / ${e.salary}`, - desc: `${prettyNum(e.views)} ${e.duration} ${e.desc}`, - }), - searchVideos.entries, - ) - const { totalCount } = searchVideos - loadSearchSuggestions(data, totalCount) - }, - }, { match: asyncRes('searchRepos'), action: ({ searchRepos }) => { diff --git a/src/containers/tool/Doraemon/logic/jumper.js b/src/containers/tool/Doraemon/logic/jumper.js index 11791599e..b18ff59c3 100755 --- a/src/containers/tool/Doraemon/logic/jumper.js +++ b/src/containers/tool/Doraemon/logic/jumper.js @@ -8,7 +8,7 @@ export const jumpToCommunity = (store, communityRaw) => { if ( contains(mainPath, [ROUTE.USER, ROUTE.DISCOVERY]) || - contains(subPath, [ROUTE.POST, ROUTE.JOB, ROUTE.VIDEO, ROUTE.REPO]) + contains(subPath, [ROUTE.POST, ROUTE.JOB, ROUTE.REPO]) ) { Global.location.href = `/${communityRaw}/posts` return false @@ -46,12 +46,6 @@ export const jumpToContent = (store) => { thread = THREAD.REPO } - // jump to video - if (startsWith('video-raw', store.activeSuggestion.raw)) { - type = TYPE.DRAWER.VIDEO_VIEW - thread = THREAD.VIDEO - } - send(EVENT.DRAWER.OPEN, { type, thread, data }) } diff --git a/src/containers/tool/Doraemon/logic/search.js b/src/containers/tool/Doraemon/logic/search.js index e0215b5b2..70efeb6ee 100755 --- a/src/containers/tool/Doraemon/logic/search.js +++ b/src/containers/tool/Doraemon/logic/search.js @@ -13,9 +13,6 @@ export const searchContents = (store, sr71$, title) => { case THREAD.USER: return sr71$.query(S.searchUsers, { name: title }) - case THREAD.VIDEO: - return sr71$.query(S.searchVideos, { title }) - case THREAD.REPO: return sr71$.query(S.searchRepos, { title }) diff --git a/src/containers/tool/Doraemon/schema.ts b/src/containers/tool/Doraemon/schema.ts index 77e1413a2..b9e5dfdb9 100755 --- a/src/containers/tool/Doraemon/schema.ts +++ b/src/containers/tool/Doraemon/schema.ts @@ -69,22 +69,6 @@ const searchJobs = gql` } } ` -const searchVideos = gql` - query($title: String!) { - searchVideos(title: $title) { - entries { - id - title - desc - thumbnil - duration - source - views - } - totalCount - } - } -` const searchRepos = gql` query($title: String!) { searchRepos(title: $title) { @@ -106,7 +90,6 @@ const schema = { searchUsers, searchPosts, searchJobs, - searchVideos, searchRepos, } diff --git a/src/containers/tool/Doraemon/styles/thread_select_bar.ts b/src/containers/tool/Doraemon/styles/thread_select_bar.ts index 660c0f5c4..d18ab4c76 100755 --- a/src/containers/tool/Doraemon/styles/thread_select_bar.ts +++ b/src/containers/tool/Doraemon/styles/thread_select_bar.ts @@ -27,10 +27,6 @@ export const Selector = styled.div` cursor: pointer; } ` - -export const VideoSelector = styled(Selector)` - ${css.media.mobile`display: none;`}; -` export const RepoSelector = styled(Selector)` ${css.media.mobile`display: none;`}; ` diff --git a/src/containers/tool/Drawer/Content/renderContent.js b/src/containers/tool/Drawer/Content/renderContent.js index a872c6205..4ed081978 100644 --- a/src/containers/tool/Drawer/Content/renderContent.js +++ b/src/containers/tool/Drawer/Content/renderContent.js @@ -10,12 +10,10 @@ import { JobViewer, MailsViewer, RepoViewer, - VideoViewer, // editors AccountEditor, PostEditor, JobEditor, - VideoEditor, RepoEditor, // utils C11NSettingPanel, @@ -53,16 +51,6 @@ const renderContent = (type, attachment, attUser, mmType) => { case TYPE.DRAWER.REPO_CREATE: return - // video - case TYPE.DRAWER.VIDEO_EDIT: - return - - case TYPE.DRAWER.VIDEO_VIEW: - return - - case TYPE.DRAWER.VIDEO_CREATE: - return - case TYPE.DRAWER.MAILS_VIEW: return diff --git a/src/containers/tool/Drawer/dynamics.tsx b/src/containers/tool/Drawer/dynamics.tsx index 0ec882a76..dd77e1680 100755 --- a/src/containers/tool/Drawer/dynamics.tsx +++ b/src/containers/tool/Drawer/dynamics.tsx @@ -49,11 +49,6 @@ export const RepoViewer = dynamic( commonConfig, ) -export const VideoViewer = dynamic( - () => import('@/containers/viewer/VideoViewer'), - commonConfig, -) - // editors export const AccountEditor = dynamic( () => import('@/containers/editor/AccountEditor'), @@ -70,11 +65,6 @@ export const JobEditor = dynamic( editorConfig, ) -export const VideoEditor = dynamic( - () => import('@/containers/editor/VideoEditor'), - editorConfig, -) - export const RepoEditor = dynamic( () => import('@/containers/editor/RepoEditor'), editorConfig, diff --git a/src/containers/tool/Drawer/store.ts b/src/containers/tool/Drawer/store.ts index 52973108c..a31a15633 100755 --- a/src/containers/tool/Drawer/store.ts +++ b/src/containers/tool/Drawer/store.ts @@ -26,7 +26,7 @@ import { SWIPE_THRESHOLD } from './styles/metrics' const defaultOptions: TSwipeOption = { direction: 'bottom', position: 'M' } -const PREVIEWABLE_THREADS = [THREAD.POST, THREAD.JOB, THREAD.VIDEO, THREAD.REPO] +const PREVIEWABLE_THREADS = [THREAD.POST, THREAD.JOB, THREAD.REPO] const THREAD_CONTENT_CURD_TYPES = [ // post TYPE.DRAWER.POST_VIEW, @@ -39,10 +39,6 @@ const THREAD_CONTENT_CURD_TYPES = [ // repo TYPE.DRAWER.REPO_VIEW, TYPE.DRAWER.REPO_CREATE, - // video - TYPE.DRAWER.VIDEO_VIEW, - TYPE.DRAWER.VIDEO_CREATE, - TYPE.DRAWER.VIDEO_EDIT, // mails TYPE.DRAWER.MAILS_VIEW, ] @@ -68,17 +64,6 @@ const Attachment = T.model('Attachment', { author: T.maybeNull(User), copyRight: T.optional(T.string, 'original'), linkAddr: T.maybeNull(T.string), - - // video spec - poster: T.maybeNull(T.string), - thumbnil: T.maybeNull(T.string), - desc: T.maybeNull(T.string), - duration: T.maybeNull(T.string), - publishAt: T.maybeNull(T.string), - source: T.maybeNull(T.string), - link: T.maybeNull(T.string), - originalAuthor: T.maybeNull(T.string), - originalAuthorLink: T.maybeNull(T.string), }) const DrawerStore = T.model('DrawerStore', { diff --git a/src/containers/tool/Drawer/styles/metrics.ts b/src/containers/tool/Drawer/styles/metrics.ts index 586085e2f..a59fb6eaf 100644 --- a/src/containers/tool/Drawer/styles/metrics.ts +++ b/src/containers/tool/Drawer/styles/metrics.ts @@ -33,8 +33,6 @@ export const WIDE_CASE = [ // repo TYPE.DRAWER.REPO_VIEW, TYPE.DRAWER.REPO_CREATE, - // video - TYPE.DRAWER.VIDEO_VIEW, // mails TYPE.DRAWER.MAILS_VIEW, ] diff --git a/src/containers/tool/FavoritesCats/logic.js b/src/containers/tool/FavoritesCats/logic.js index f9541301f..3ad62175a 100755 --- a/src/containers/tool/FavoritesCats/logic.js +++ b/src/containers/tool/FavoritesCats/logic.js @@ -129,7 +129,6 @@ const DataSolver = [ markLoading(false) store.mark({ pagedCategories }) // store.closeDrawer() - // send(EVENT.REFRESH_VIDEOS) }, }, { diff --git a/src/containers/tool/FavoritesCats/store.js b/src/containers/tool/FavoritesCats/store.js index 671083140..c7d6539e2 100755 --- a/src/containers/tool/FavoritesCats/store.js +++ b/src/containers/tool/FavoritesCats/store.js @@ -40,10 +40,7 @@ const FavoritesCats = T.model('FavoritesCats', { // open creator from setter, so we can go back to setter based on this state createfromSetter: T.optional(T.boolean, false), thread: T.maybeNull( - T.enumeration( - [THREAD.POST, THREAD.JOB, THREAD.VIDEO, THREAD.REPO], - THREAD.POST, - ), + T.enumeration([THREAD.POST, THREAD.JOB, THREAD.REPO], THREAD.POST), ), loading: T.optional(T.boolean, false), doing: T.optional(T.boolean, false), @@ -72,9 +69,6 @@ const FavoritesCats = T.model('FavoritesCats', { case THREAD.REPO: return stripMobx(self.root.viewing.repo) - case THREAD.VIDEO: - return stripMobx(self.root.viewing.video) - default: return stripMobx(self.root.viewing.post) } diff --git a/src/containers/unit/ArticleBodyHeader/logic.js b/src/containers/unit/ArticleBodyHeader/logic.js index 0e3c97fc1..3d44c9dbc 100755 --- a/src/containers/unit/ArticleBodyHeader/logic.js +++ b/src/containers/unit/ArticleBodyHeader/logic.js @@ -24,10 +24,6 @@ export const onEdit = (thread) => { type = TYPE.DRAWER.JOB_EDIT break - case THREAD.VIDEO: - type = TYPE.DRAWER.VIDEO_EDIT - break - case THREAD.REPO: return send(EVENT.SYNC_REPO) @@ -51,9 +47,6 @@ export const onPin = (thread) => { case THREAD.JOB: return sr71$.mutate(S.pinJob, args) - case THREAD.VIDEO: - return sr71$.mutate(S.pinVideo, args) - case THREAD.REPO: return sr71$.mutate(S.pinRepo, args) @@ -74,9 +67,6 @@ export const onUndoPin = (thread) => { case THREAD.JOB: return sr71$.mutate(S.undoPinJob, args) - case THREAD.VIDEO: - return sr71$.mutate(S.undoPinVideo, args) - case THREAD.REPO: return sr71$.mutate(S.undoPinRepo, args) @@ -116,9 +106,6 @@ export const onDelete = () => { case THREAD.JOB: return sr71$.mutate(S.deleteJob, { id }) - case THREAD.VIDEO: - return sr71$.mutate(S.deleteVideo, { id }) - case THREAD.REPO: return sr71$.mutate(S.deleteRepo, { id }) @@ -149,15 +136,13 @@ const backToParentThread = () => { REFRESH_EVENT = EVENT.REFRESH_POSTS } else if (store.activeThread === THREAD.JOB) { REFRESH_EVENT = EVENT.REFRESH_JOBS - } else if (store.activeThread === THREAD.VIDEO) { - REFRESH_EVENT = EVENT.REFRESH_VIDEOS } else if (store.activeThread === THREAD.REPO) { REFRESH_EVENT = EVENT.REFRESH_REPOS } send(REFRESH_EVENT) closeDrawer() - store.setViewing({ post: {}, job: {}, repo: {}, video: {} }) + store.setViewing({ post: {}, job: {}, repo: {} }) } // ############################### @@ -191,19 +176,6 @@ const DataSolver = [ match: asyncRes('deleteJob'), action: () => backToParentThread(), }, - // video - { - match: asyncRes('pinVideo'), - action: () => backToParentThread(), - }, - { - match: asyncRes('undoPinVideo'), - action: () => backToParentThread(), - }, - { - match: asyncRes('deleteVideo'), - action: () => backToParentThread(), - }, // repo { match: asyncRes('pinRepo'), diff --git a/src/containers/unit/ArticleBodyHeader/schema.ts b/src/containers/unit/ArticleBodyHeader/schema.ts index ae17b4f30..f8e610bf0 100755 --- a/src/containers/unit/ArticleBodyHeader/schema.ts +++ b/src/containers/unit/ArticleBodyHeader/schema.ts @@ -46,30 +46,6 @@ const deleteJob = gql` } } ` -// video -const pinVideo = gql` - mutation($id: ID!, $communityId: ID!) { - pinVideo(id: $id, communityId: $communityId) { - id - } - } -` -const undoPinVideo = gql` - mutation($id: ID!, $communityId: ID!) { - undoPinVideo(id: $id, communityId: $communityId) { - id - } - } -` - -const deleteVideo = gql` - mutation($id: ID!) { - deleteVideo(id: $id) { - id - } - } -` - // repo const pinRepo = gql` mutation($id: ID!, $communityId: ID!) { @@ -137,10 +113,6 @@ const schema = { pinJob, undoPinJob, deleteJob, - // video - pinVideo, - undoPinVideo, - deleteVideo, // repo pinRepo, undoPinRepo, diff --git a/src/containers/unit/ArticleViewerHeader/logic.js b/src/containers/unit/ArticleViewerHeader/logic.js index 7e7b4875c..2ef37fb0d 100755 --- a/src/containers/unit/ArticleViewerHeader/logic.js +++ b/src/containers/unit/ArticleViewerHeader/logic.js @@ -54,9 +54,6 @@ const afterReaction = (id) => { case THREAD.JOB: return sr71$.query(S.job, { id }) - case THREAD.VIDEO: - return sr71$.query(S.video, { id }) - case THREAD.REPO: return sr71$.query(S.repo, { id }) @@ -88,14 +85,6 @@ const DataSolver = [ markLoading(false) }, }, - { - match: asyncRes('video'), - action: ({ video }) => { - markLoading(false) - store.setViewing({ video: merge(store.viewingData, video) }) - // store.syncViewingItem(video) - }, - }, { match: asyncRes('repo'), action: ({ repo }) => { diff --git a/src/containers/unit/ArticleViewerHeader/schema.ts b/src/containers/unit/ArticleViewerHeader/schema.ts index 7f7ddf8bb..542a266dd 100755 --- a/src/containers/unit/ArticleViewerHeader/schema.ts +++ b/src/containers/unit/ArticleViewerHeader/schema.ts @@ -30,18 +30,6 @@ const job = gql` } } ` -const video = gql` - query($id: ID!) { - video(id: $id) { - id - favoritedCount - starredCount - viewerHasFavorited - viewerHasStarred - favoritedCategoryId - } - } -` const repo = gql` query($id: ID!) { repo(id: $id) { @@ -58,7 +46,6 @@ const schema = { undoReaction, post, job, - video, repo, } diff --git a/src/containers/user/UserFavorited/Breadcrumbs.js b/src/containers/user/UserFavorited/Breadcrumbs.js index 23a43bfe7..ce746deab 100755 --- a/src/containers/user/UserFavorited/Breadcrumbs.js +++ b/src/containers/user/UserFavorited/Breadcrumbs.js @@ -40,7 +40,7 @@ const Breadcrumbs = ({ active={curThread} onSelect={changeFavoriteThread} totalCount={totalCount} - options={[THREAD.POST, THREAD.JOB, THREAD.VIDEO, THREAD.REPO]} + options={[THREAD.POST, THREAD.JOB, THREAD.REPO]} /> diff --git a/src/containers/user/UserFavorited/logic.js b/src/containers/user/UserFavorited/logic.js index bee0ae342..d6f6a38ae 100755 --- a/src/containers/user/UserFavorited/logic.js +++ b/src/containers/user/UserFavorited/logic.js @@ -40,9 +40,6 @@ export const loadPosts = (page = 1) => export const loadJobs = (page = 1) => sr71$.query(S.favoritedJobs, getQueryArgs(page)) -export const loadVideos = (page = 1) => - sr71$.query(S.favoritedVideos, getQueryArgs(page)) - export const loadRepos = (page = 1) => sr71$.query(S.favoritedRepos, getQueryArgs(page)) @@ -51,9 +48,6 @@ export const onReload = (page) => { case THREAD.JOB: return loadJobs(page) - case THREAD.VIDEO: - return loadVideos(page) - case THREAD.REPO: return loadRepos(page) @@ -91,10 +85,6 @@ const DataSolver = [ match: asyncRes('favoritedJobs'), action: ({ favoritedJobs }) => store.markPagedData(favoritedJobs), }, - { - match: asyncRes('favoritedVideos'), - action: ({ favoritedVideos }) => store.markPagedData(favoritedVideos), - }, { match: asyncRes('favoritedRepos'), action: ({ favoritedRepos }) => store.markPagedData(favoritedRepos), diff --git a/src/containers/user/UserFavorited/schema.ts b/src/containers/user/UserFavorited/schema.ts index 279d1139d..c3b15f259 100755 --- a/src/containers/user/UserFavorited/schema.ts +++ b/src/containers/user/UserFavorited/schema.ts @@ -8,13 +8,6 @@ const favoritedJobs = gql` } } ` -const favoritedVideos = gql` - query($userId: ID!, $categoryId: ID, $filter: PagedFilter!) { - favoritedVideos(userId: $userId, categoryId: $categoryId, filter: $filter) { - ${F.pagedVideos} - } - } -` const favoritedRepos = gql` query($userId: ID!, $categoryId: ID, $filter: PagedFilter!) { favoritedRepos(userId: $userId, categoryId: $categoryId, filter: $filter) { @@ -35,8 +28,6 @@ const schema = { favoritedPosts, // job favoritedJobs, - // video - favoritedVideos, // repo favoritedRepos, } diff --git a/src/containers/user/UserFavorited/store.js b/src/containers/user/UserFavorited/store.js index a442baeac..7817427a9 100755 --- a/src/containers/user/UserFavorited/store.js +++ b/src/containers/user/UserFavorited/store.js @@ -11,7 +11,6 @@ import { markStates, buildLog, stripMobx } from '@/utils' import { PagedPosts, PagedJobs, - PagedVideos, PagedRepos, emptyPagiData, FavoriteCategory, @@ -23,12 +22,7 @@ const log = buildLog('S:UserFavorited') const UserFavorited = T.model('UserFavorited', { curCategory: T.maybeNull(FavoriteCategory), curThread: T.optional( - T.enumeration('favoriteThread', [ - THREAD.POST, - THREAD.VIDEO, - THREAD.JOB, - THREAD.REPO, - ]), + T.enumeration('favoriteThread', [THREAD.POST, THREAD.JOB, THREAD.REPO]), THREAD.POST, ), parentView: T.optional( @@ -52,7 +46,6 @@ const UserFavorited = T.model('UserFavorited', { ), pagedPosts: T.optional(PagedPosts, emptyPagiData), pagedJobs: T.optional(PagedJobs, emptyPagiData), - pagedVideos: T.optional(PagedVideos, emptyPagiData), pagedRepos: T.optional(PagedRepos, emptyPagiData), }) .views((self) => ({ @@ -70,9 +63,6 @@ const UserFavorited = T.model('UserFavorited', { case THREAD.JOB: return stripMobx(self.pagedJobs) - case THREAD.VIDEO: - return stripMobx(self.pagedVideos) - case THREAD.REPO: return stripMobx(self.pagedRepos) @@ -93,9 +83,6 @@ const UserFavorited = T.model('UserFavorited', { case THREAD.JOB: return self.mark({ curView, pagedJobs: pagedData }) - case THREAD.VIDEO: - return self.mark({ curView, pagedVideos: pagedData }) - case THREAD.REPO: return self.mark({ curView, pagedRepos: pagedData }) diff --git a/src/containers/user/UserPublished/logic.js b/src/containers/user/UserPublished/logic.js index 46adcffde..6d9ca8faf 100755 --- a/src/containers/user/UserPublished/logic.js +++ b/src/containers/user/UserPublished/logic.js @@ -29,9 +29,6 @@ export const loadPosts = (page = 1) => export const loadJobs = (page = 1) => sr71$.query(S.publishedJobs, getQueryArgs(page)) -export const loadVideos = (page = 1) => - sr71$.query(S.publishedVideos, getQueryArgs(page)) - export const loadRepos = (page = 1) => sr71$.query(S.publishedRepos, getQueryArgs(page)) @@ -40,9 +37,6 @@ export const onReload = (page) => { case THREAD.JOB: return loadJobs(page) - case THREAD.VIDEO: - return loadVideos(page) - case THREAD.REPO: return loadRepos(page) @@ -79,10 +73,6 @@ const DataSolver = [ match: asyncRes('publishedJobs'), action: ({ publishedJobs }) => store.markPagedData(publishedJobs), }, - { - match: asyncRes('publishedVideos'), - action: ({ publishedVideos }) => store.markPagedData(publishedVideos), - }, { match: asyncRes('publishedRepos'), action: ({ publishedRepos }) => store.markPagedData(publishedRepos), @@ -91,7 +81,9 @@ const DataSolver = [ const ErrSolver = [ { match: asyncErr(ERR.GRAPHQL), - action: () => {}, + action: () => { + // + }, }, { match: asyncErr(ERR.TIMEOUT), diff --git a/src/containers/user/UserPublished/schema.ts b/src/containers/user/UserPublished/schema.ts index 01de5b832..5edf7db52 100755 --- a/src/containers/user/UserPublished/schema.ts +++ b/src/containers/user/UserPublished/schema.ts @@ -15,13 +15,6 @@ const publishedJobs = gql` } } ` -const publishedVideos = gql` - query($userId: ID!, $filter: PagedFilter!) { - publishedVideos(userId: $userId, filter: $filter) { - ${F.pagedVideos} - } - } -` const publishedRepos = gql` query($userId: ID!, $filter: PagedFilter!) { publishedRepos(userId: $userId, filter: $filter) { @@ -33,7 +26,6 @@ const publishedRepos = gql` const schema = { publishedPosts, publishedJobs, - publishedVideos, publishedRepos, } diff --git a/src/containers/user/UserPublished/store.js b/src/containers/user/UserPublished/store.js index f7f112ab1..f882e8a7e 100755 --- a/src/containers/user/UserPublished/store.js +++ b/src/containers/user/UserPublished/store.js @@ -7,25 +7,14 @@ import { types as T, getParent } from 'mobx-state-tree' import { TYPE, THREAD } from '@/constant' import { markStates, buildLog, stripMobx } from '@/utils' -import { - PagedPosts, - PagedJobs, - PagedVideos, - PagedRepos, - emptyPagiData, -} from '@/model' +import { PagedPosts, PagedJobs, PagedRepos, emptyPagiData } from '@/model' /* eslint-disable-next-line */ const log = buildLog('S:UserPublished') const UserPublished = T.model('UserPublished', { curThread: T.optional( - T.enumeration('curThread', [ - THREAD.POST, - THREAD.JOB, - THREAD.VIDEO, - THREAD.REPO, - ]), + T.enumeration('curThread', [THREAD.POST, THREAD.JOB, THREAD.REPO]), THREAD.POST, ), @@ -40,7 +29,6 @@ const UserPublished = T.model('UserPublished', { ), pagedPosts: T.optional(PagedPosts, emptyPagiData), pagedJobs: T.optional(PagedJobs, emptyPagiData), - pagedVideos: T.optional(PagedVideos, emptyPagiData), pagedRepos: T.optional(PagedRepos, emptyPagiData), }) .views((self) => ({ @@ -58,9 +46,6 @@ const UserPublished = T.model('UserPublished', { case THREAD.JOB: return stripMobx(self.pagedJobs) - case THREAD.VIDEO: - return stripMobx(self.pagedVideos) - case THREAD.REPO: return stripMobx(self.pagedRepos) @@ -78,9 +63,6 @@ const UserPublished = T.model('UserPublished', { case THREAD.JOB: return self.mark({ curView, pagedJobs: pagedData }) - case THREAD.VIDEO: - return self.mark({ curView, pagedVideos: pagedData }) - case THREAD.REPO: return self.mark({ curView, pagedRepos: pagedData }) diff --git a/src/containers/user/UserPublishedComments/Parent.js b/src/containers/user/UserPublishedComments/Parent.js index 7e54c7fdf..3c3c40562 100755 --- a/src/containers/user/UserPublishedComments/Parent.js +++ b/src/containers/user/UserPublishedComments/Parent.js @@ -34,16 +34,6 @@ const Parent = ({ thread, data }) => { ) - case THREAD.VIDEO: - return ( - - {data.video.title} - - - - - ) - default: return ( diff --git a/src/containers/user/UserPublishedComments/logic.js b/src/containers/user/UserPublishedComments/logic.js index 3ff941b74..82d4faa0e 100755 --- a/src/containers/user/UserPublishedComments/logic.js +++ b/src/containers/user/UserPublishedComments/logic.js @@ -37,9 +37,6 @@ export const loadPostComments = (page = 1) => export const loadJobComments = (page = 1) => sr71$.query(S.publishedJobComments, getQueryArgs(page)) -export const loadVideoComments = (page = 1) => - sr71$.query(S.publishedVideoComments, getQueryArgs(page)) - export const loadRepoComments = (page = 1) => sr71$.query(S.publishedRepoComments, getQueryArgs(page)) @@ -51,9 +48,6 @@ export const threadOnChange = (curThread) => { case THREAD.JOB: return loadJobComments() - case THREAD.VIDEO: - return loadVideoComments() - case THREAD.REPO: return loadRepoComments() @@ -68,9 +62,6 @@ export const onPageChange = (page = 1) => { case THREAD.JOB: return loadJobComments(page) - case THREAD.VIDEO: - return loadVideoComments(page) - case THREAD.REPO: return loadRepoComments(page) @@ -104,11 +95,6 @@ const DataSolver = [ action: ({ publishedJobComments }) => store.markPagedData(publishedJobComments), }, - { - match: asyncRes('publishedVideoComments'), - action: ({ publishedVideoComments }) => - store.markPagedData(publishedVideoComments), - }, { match: asyncRes('publishedRepoComments'), action: ({ publishedRepoComments }) => { @@ -121,7 +107,9 @@ const DataSolver = [ const ErrSolver = [ { match: asyncErr(ERR.GRAPHQL), - action: () => {}, + action: () => { + // + }, }, { match: asyncErr(ERR.TIMEOUT), diff --git a/src/containers/user/UserPublishedComments/schema.ts b/src/containers/user/UserPublishedComments/schema.ts index 24130ffcc..8bc06e4e7 100755 --- a/src/containers/user/UserPublishedComments/schema.ts +++ b/src/containers/user/UserPublishedComments/schema.ts @@ -30,20 +30,6 @@ const publishedJobComments = gql` } ` -const publishedVideoComments = gql` - query($userId: ID!, $filter: PagedFilter!) { - publishedVideoComments(userId: $userId, filter: $filter) { - entries { - ${F.comment} - video { - ${F.commentParent} - } - } - ${F.pagedCounts} - } - } -` - const publishedRepoComments = gql` query($userId: ID!, $filter: PagedFilter!) { publishedRepoComments(userId: $userId, filter: $filter) { @@ -62,7 +48,6 @@ const publishedRepoComments = gql` const schema = { publishedPostComments, publishedJobComments, - publishedVideoComments, publishedRepoComments, } diff --git a/src/containers/user/UserPublishedComments/store.js b/src/containers/user/UserPublishedComments/store.js index de3a695e9..8cb618061 100755 --- a/src/containers/user/UserPublishedComments/store.js +++ b/src/containers/user/UserPublishedComments/store.js @@ -10,7 +10,6 @@ import { markStates, buildLog, stripMobx } from '@/utils' import { PagedPostComments, PagedJobComments, - PagedVideoComments, PagedRepoComments, emptyPagiData, } from '@/model' @@ -20,12 +19,7 @@ const log = buildLog('S:UserPublishedComments') const UserPublishedComments = T.model('UserPublishedComments', { curThread: T.optional( - T.enumeration('curThread', [ - THREAD.POST, - THREAD.JOB, - THREAD.VIDEO, - THREAD.REPO, - ]), + T.enumeration('curThread', [THREAD.POST, THREAD.JOB, THREAD.REPO]), THREAD.POST, ), @@ -41,7 +35,6 @@ const UserPublishedComments = T.model('UserPublishedComments', { pagedPostComments: T.optional(PagedPostComments, emptyPagiData), pagedJobComments: T.optional(PagedJobComments, emptyPagiData), - pagedVideoComments: T.optional(PagedVideoComments, emptyPagiData), pagedRepoComments: T.optional(PagedRepoComments, emptyPagiData), }) .views((self) => ({ @@ -56,9 +49,6 @@ const UserPublishedComments = T.model('UserPublishedComments', { case THREAD.JOB: { return stripMobx(self.pagedJobComments) } - case THREAD.VIDEO: { - return stripMobx(self.pagedVideoComments) - } case THREAD.REPO: { return stripMobx(self.pagedRepoComments) } @@ -77,9 +67,6 @@ const UserPublishedComments = T.model('UserPublishedComments', { case THREAD.JOB: return self.mark({ curView, pagedJobComments: pagedData }) - case THREAD.VIDEO: - return self.mark({ curView, pagedVideoComments: pagedData }) - case THREAD.REPO: return self.mark({ curView, pagedRepoComments: pagedData }) diff --git a/src/containers/user/UserStared/index.js b/src/containers/user/UserStared/index.js index 145ce379a..36b6ec724 100755 --- a/src/containers/user/UserStared/index.js +++ b/src/containers/user/UserStared/index.js @@ -32,7 +32,7 @@ const UserStaredContainer = ({ userStared: store }) => { onSelect={onThreadChange} totalCount={totalCount} lookLike="box" - options={[THREAD.POST, THREAD.JOB, THREAD.VIDEO]} + options={[THREAD.POST, THREAD.JOB]} /> diff --git a/src/containers/user/UserStared/logic.js b/src/containers/user/UserStared/logic.js index 57080ff21..7383842e3 100755 --- a/src/containers/user/UserStared/logic.js +++ b/src/containers/user/UserStared/logic.js @@ -30,17 +30,11 @@ export const loadPosts = (page = 1) => export const loadJobs = (page = 1) => sr71$.query(S.staredJobs, getQueryArgs(page)) -export const loadVideos = (page = 1) => - sr71$.query(S.staredVideos, getQueryArgs(page)) - export const onReload = (page) => { switch (store.curThread) { case THREAD.JOB: return loadJobs(page) - case THREAD.VIDEO: - return loadVideos(page) - default: return loadPosts(page) } @@ -75,15 +69,13 @@ const DataSolver = [ match: asyncRes('staredJobs'), action: ({ staredJobs }) => store.markPagedData(staredJobs), }, - { - match: asyncRes('staredVideos'), - action: ({ staredVideos }) => store.markPagedData(staredVideos), - }, ] const ErrSolver = [ { match: asyncErr(ERR.GRAPHQL), - action: () => {}, + action: () => { + // + }, }, { match: asyncErr(ERR.TIMEOUT), diff --git a/src/containers/user/UserStared/schema.ts b/src/containers/user/UserStared/schema.ts index 05a5f4d45..a9eb5016c 100755 --- a/src/containers/user/UserStared/schema.ts +++ b/src/containers/user/UserStared/schema.ts @@ -56,38 +56,10 @@ const staredJobs = gql` } } ` -const staredVideos = gql` - query($userId: ID!, $filter: PagedFilter!) { - staredVideos(userId: $userId, filter: $filter) { - entries { - id - title - poster - desc - duration - source - views - originalAuthor - originalAuthorLink - author { - id - avatar - nickname - } - insertedAt - publishAt - } - totalPages - totalCount - pageSize - pageNumber - } - } -` + const schema = { staredPosts, staredJobs, - staredVideos, } export default schema diff --git a/src/containers/user/UserStared/store.js b/src/containers/user/UserStared/store.js index bc06ad075..8348d3b5e 100755 --- a/src/containers/user/UserStared/store.js +++ b/src/containers/user/UserStared/store.js @@ -7,19 +7,14 @@ import { types as T, getParent } from 'mobx-state-tree' import { TYPE, THREAD } from '@/constant' import { markStates, buildLog, stripMobx } from '@/utils' -import { PagedPosts, PagedJobs, PagedVideos, emptyPagiData } from '@/model' +import { PagedPosts, PagedJobs, emptyPagiData } from '@/model' /* eslint-disable-next-line */ const log = buildLog('S:UserStared') const UserStared = T.model('UserStared', { curThread: T.optional( - T.enumeration('curThread', [ - THREAD.POST, - THREAD.JOB, - THREAD.VIDEO, - THREAD.REPO, - ]), + T.enumeration('curThread', [THREAD.POST, THREAD.JOB, THREAD.REPO]), THREAD.POST, ), curView: T.optional( @@ -33,7 +28,6 @@ const UserStared = T.model('UserStared', { ), pagedPosts: T.optional(PagedPosts, emptyPagiData), pagedJobs: T.optional(PagedJobs, emptyPagiData), - pagedVideos: T.optional(PagedVideos, emptyPagiData), }) .views((self) => ({ get root() { @@ -47,9 +41,6 @@ const UserStared = T.model('UserStared', { case THREAD.JOB: return stripMobx(self.pagedJobs) - case THREAD.VIDEO: - return stripMobx(self.pagedVideos) - default: return stripMobx(self.pagedPosts) } @@ -67,9 +58,6 @@ const UserStared = T.model('UserStared', { case THREAD.JOB: { return self.mark({ curView, pagedJobs: pagedData }) } - case THREAD.VIDEO: { - return self.mark({ curView, pagedVideos: pagedData }) - } default: { return self.mark({ curView, pagedPosts: pagedData }) } diff --git a/src/containers/viewer/VideoViewer/index.js b/src/containers/viewer/VideoViewer/index.js deleted file mode 100755 index f2354996b..000000000 --- a/src/containers/viewer/VideoViewer/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * VideoViewer - * - */ - -import React from 'react' - -import { THREAD } from '@/constant' -import { pluggedIn, buildLog } from '@/utils' - -import ArticleViewerHeader from '@/containers/unit/ArticleViewerHeader' -import ArticleBodyHeader from '@/containers/unit/ArticleBodyHeader' -import Comments from '@/containers/unit/Comments' -import Maybe from '@/components/Maybe' -import VideoPoster from '@/components/VideoPoster' -import VideoInfoCard from '@/components/VideoInfoCard' - -import { Wrapper, BodyHeaderWrapper, CommentsWrapper } from './styles' -import { useInit } from './logic' - -/* eslint-disable-next-line */ -const log = buildLog('C:VideoViewer') - -const VideoViewerContainer = ({ videoViewer: store, attachment }) => { - useInit(store, attachment) - - const { curCommunity, viewingData } = store - - return ( - - - - - - - - - - - - - - - - ) -} - -export default pluggedIn(VideoViewerContainer) diff --git a/src/containers/viewer/VideoViewer/logic.js b/src/containers/viewer/VideoViewer/logic.js deleted file mode 100755 index 98adbf7c2..000000000 --- a/src/containers/viewer/VideoViewer/logic.js +++ /dev/null @@ -1,86 +0,0 @@ -import { useEffect } from 'react' -import { merge } from 'ramda' - -import { TYPE, ERR } from '@/constant' -import { asyncSuit, buildLog, errRescue } from '@/utils' -import S from './schema' - -/* eslint-disable-next-line */ -const log = buildLog('L:VideoViewer') - -const { SR71, $solver, asyncRes, asyncErr } = asyncSuit -const sr71$ = new SR71() - -let sub$ = null -let store = null - -const loadVideo = ({ id }) => { - const userHasLogin = store.isLogin - const variables = { id, userHasLogin } - markLoading(true) - sr71$.query(S.video, variables) -} - -const markLoading = (maybe = true) => store.mark({ loading: maybe }) -// ############################### -// Data & Error handlers -// ############################### - -const DataSolver = [ - { - match: asyncRes('video'), - action: ({ video }) => { - markLoading(false) - store.setViewing({ video: merge(store.viewingData, video) }) - /* loading(false) */ - }, - }, -] -const ErrSolver = [ - { - match: asyncErr(ERR.GRAPHQL), - action: () => markLoading(false), - }, - { - match: asyncErr(ERR.TIMEOUT), - action: ({ details }) => { - markLoading(false) - errRescue({ type: ERR.TIMEOUT, details, path: 'VideoViewer' }) - }, - }, - { - match: asyncErr(ERR.NETWORK), - action: () => { - markLoading(false) - errRescue({ type: ERR.NETWORK, path: 'VideoViewer' }) - }, - }, -] - -const openAttachment = (att) => { - if (!att) return false - const { type } = att - if (type === TYPE.DRAWER.VIDEO_VIEW) { - loadVideo(att) - store.setViewing({ video: att }) - } -} - -export const holder = 1 -// ############################### -// init & uninit -// ############################### -export const useInit = (_store, attachment) => { - useEffect(() => { - store = _store - // log('effect init') - sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver)) - openAttachment(attachment) - - return () => { - // log('effect uninit') - sr71$.stop() - sub$.unsubscribe() - } - }, [_store, attachment]) -} diff --git a/src/containers/viewer/VideoViewer/schema.ts b/src/containers/viewer/VideoViewer/schema.ts deleted file mode 100755 index 3f40eeccf..000000000 --- a/src/containers/viewer/VideoViewer/schema.ts +++ /dev/null @@ -1,31 +0,0 @@ -import gql from 'graphql-tag' -import { F } from '@/schemas' - -const video = gql` - query($id: ID!, $userHasLogin: Boolean!) { - video(id: $id) { - ${F.video} - link - author { - ${F.author} - } - tags { - ${F.tag} - } - origialCommunity { - ${F.community} - } - favoritedCount - starredCount - viewerHasFavorited @include(if: $userHasLogin) - viewerHasStarred @include(if: $userHasLogin) - favoritedCategoryId @include(if: $userHasLogin) - } - } -` - -const schema = { - video, -} - -export default schema diff --git a/src/containers/viewer/VideoViewer/store.js b/src/containers/viewer/VideoViewer/store.js deleted file mode 100755 index a47b3322f..000000000 --- a/src/containers/viewer/VideoViewer/store.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * VideoViewer store - * - */ - -import { types as T, getParent } from 'mobx-state-tree' - -import { markStates, buildLog, stripMobx } from '@/utils' -/* eslint-disable-next-line */ -const log = buildLog('S:VideoViewer') - -const VideoViewer = T.model('VideoViewer', { - loading: T.optional(T.boolean, false), -}) - .views((self) => ({ - get root() { - return getParent(self) - }, - get isLogin() { - return self.root.account.isLogin - }, - get viewingData() { - return self.root.viewingData - }, - get curCommunity() { - return stripMobx(self.root.viewing.community) - }, - })) - .actions((self) => ({ - setViewing(sobj) { - self.root.setViewing(sobj) - }, - mark(sobj) { - markStates(sobj, self) - }, - })) - -export default VideoViewer diff --git a/src/containers/viewer/VideoViewer/styles/index.js b/src/containers/viewer/VideoViewer/styles/index.js deleted file mode 100755 index be7448a45..000000000 --- a/src/containers/viewer/VideoViewer/styles/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import styled from 'styled-components' - -import { theme, css } from '@/utils' - -export const Wrapper = styled.div`` - -export const CommentsWrapper = styled.div` - min-height: 200px; - margin-top: 20px; - margin-left: 4%; - margin-right: 4%; - margin-bottom: 10%; - border-radius: 5px; -` - -export const BodyHeaderWrapper = styled.div` - ${css.flex('justify-between', 'align-center')}; - background-color: ${theme('drawer.articleBg')}; - width: 100%; - padding: 8px 32px; -` diff --git a/src/containers/viewer/VideoViewer/tests/index.test.ts b/src/containers/viewer/VideoViewer/tests/index.test.ts deleted file mode 100755 index 7727022ac..000000000 --- a/src/containers/viewer/VideoViewer/tests/index.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import React from 'react' -// import { shallow } from 'enzyme' - -// import VideoViewer from '../index' - -describe('TODO ', () => { - it('Expect to have unit tests specified', () => { - expect(true).toEqual(true) - }) -}) diff --git a/src/containers/viewer/VideoViewer/tests/store.test.ts b/src/containers/viewer/VideoViewer/tests/store.test.ts deleted file mode 100755 index c9430e638..000000000 --- a/src/containers/viewer/VideoViewer/tests/store.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * VideoViewer store test - * - */ - -// import VideoViewer from '../index' - -it('TODO: store test VideoViewer', () => { - expect(1 + 1).toBe(2) -}) diff --git a/src/pages/community.tsx b/src/pages/community.tsx index 0259cd386..d239aa8ec 100755 --- a/src/pages/community.tsx +++ b/src/pages/community.tsx @@ -18,7 +18,6 @@ import { ssrPagedSchema, ssrPagedFilter, ssrContentsThread, - addTopicIfNeed, ssrAmbulance, validCommunityFilters, parseTheme, @@ -43,19 +42,15 @@ const fetchData = async (props, opt = {}) => { // const { asPath } = props // schema - const { communityPath, threadPath: topic, thread } = ssrParseURL(props.req) + const { communityPath, thread } = ssrParseURL(props.req) const community = akaTranslate(communityPath) - let filter = addTopicIfNeed( - { - // @ts-ignore TODO: - ...queryStringToJSON(props.req.url, { pagi: 'number' }), - community, - }, + let filter = { + // @ts-ignore TODO: + ...queryStringToJSON(props.req.url, { pagi: 'number' }), + community, thread, - topic, - ) - + } filter = pick(validCommunityFilters, filter) // query data diff --git a/src/pages/video.js b/src/pages/video.js deleted file mode 100755 index b86a4df42..000000000 --- a/src/pages/video.js +++ /dev/null @@ -1,124 +0,0 @@ -import React from 'react' -import { Provider } from 'mobx-react' -import { toUpper } from 'ramda' - -import { PAGE_SIZE, SITE_URL } from '@/config' -import { TYPE, ROUTE, METRIC, THREAD } from '@/constant' -import { - getJwtToken, - nilOrEmpty, - makeGQClient, - ssrParseURL, - ssrAmbulance, - parseTheme, -} from '@/utils' -import { useStore } from '@/stores/init' - -import GlobalLayout from '@/containers/layout/GlobalLayout' -import ArticleDigest from '@/containers/digest/ArticleDigest' -import VideoContent from '@/containers/content/VideoContent' - -import { P } from '@/schemas' - -export const fetchData = async (props) => { - const token = getJwtToken(props) - const gqClient = makeGQClient(token) - const userHasLogin = nilOrEmpty(token) === false - - const { thirdPath: id } = ssrParseURL(props.req) - // query data - const sessionState = gqClient.request(P.sessionState) - const video = gqClient.request(P.video, { id }) - const pagedComments = gqClient.request(P.pagedComments, { - id, - userHasLogin, - thread: toUpper(THREAD.VIDEO), - filter: { page: 1, size: PAGE_SIZE.D, sort: TYPE.ASC_INSERTED }, - }) - const subscribedCommunities = gqClient.request(P.subscribedCommunities, { - filter: { - page: 1, - size: 30, - }, - }) - - return { - ...(await sessionState), - ...(await video), - ...(await pagedComments), - ...(await subscribedCommunities), - } -} - -export const getServerSideProps = async (props) => { - const { mainPath } = ssrParseURL(props.req) - - let resp - try { - resp = await fetchData(props) - } catch ({ response: { errors } }) { - if (ssrAmbulance.hasLoginError(errors)) { - resp = await fetchData(props, { realname: false }) - } else { - return { props: { errorCode: 404 } } - } - } - - const { sessionState, video, pagedComments, subscribedCommunities } = resp - - const { origialCommunity: community, ...viewingContent } = video - const initProps = { - theme: { - curTheme: parseTheme(sessionState), - }, - account: { - user: sessionState.user || {}, - isValidSession: sessionState.isValid, - userSubscribedCommunities: subscribedCommunities, - }, - route: { mainPath, subPath: ROUTE.VIDEO }, - viewing: { - video: viewingContent, - activeThread: THREAD.VIDEO, - community, - }, - comments: { pagedComments }, - } - - return { props: { errorCode: null, ...initProps } } -} - -const VideoPage = (props) => { - const store = useStore(props) - - const { errorCode, viewing, route } = props - const { video } = viewing - const { mainPath } = route - - const seoConfig = { - url: `${SITE_URL}/${mainPath}/video/${video.id}`, - title: `${video.title}`, - datePublished: `${video.insertedAt}`, - dateModified: `${video.updatedAt}`, - authorName: `${video.author.nickname}`, - description: `${video.title}`, - images: [], - } - - return ( - - - - - - - ) -} - -export default VideoPage diff --git a/src/schemas/fragments/base.ts b/src/schemas/fragments/base.ts index 8230bcf7b..495cb959c 100755 --- a/src/schemas/fragments/base.ts +++ b/src/schemas/fragments/base.ts @@ -34,21 +34,6 @@ export const job = ` insertedAt updatedAt ` -export const video = ` - id - title - poster - thumbnil - desc - duration - source - views - originalAuthor - originalAuthorLink - publishAt - insertedAt - updatedAt -` export const repo = ` id views @@ -79,10 +64,6 @@ export const tag = ` title color thread - topic { - id - raw - } ` export const author = ` id diff --git a/src/schemas/fragments/index.ts b/src/schemas/fragments/index.ts index a36865bcb..832542e55 100755 --- a/src/schemas/fragments/index.ts +++ b/src/schemas/fragments/index.ts @@ -12,7 +12,6 @@ import { community, post, job, - video, repo, author, tag, @@ -27,19 +26,17 @@ import { pagedCounts, } from './base' -import { pagedPosts, pagedJobs, pagedVideos, pagedRepos } from './paged' +import { pagedPosts, pagedJobs, pagedRepos } from './paged' const F = { community, post, job, - video, repo, author, tag, pagedPosts, pagedJobs, - pagedVideos, pagedRepos, user, diff --git a/src/schemas/fragments/paged.ts b/src/schemas/fragments/paged.ts index ad90d8130..8ea58bc84 100755 --- a/src/schemas/fragments/paged.ts +++ b/src/schemas/fragments/paged.ts @@ -1,4 +1,4 @@ -import { post, job, video, repo, tag, author, pagedCounts } from './base' +import { post, job, repo, tag, author, pagedCounts } from './base' export const pagedPosts = ` entries { @@ -30,16 +30,6 @@ export const pagedJobs = ` ${pagedCounts} ` -export const pagedVideos = ` - entries { - ${video} - author { - ${author} - } - } - ${pagedCounts} -` - export const pagedRepos = ` entries { ${repo} diff --git a/src/schemas/index.ts b/src/schemas/index.ts index d973bcb9a..e7acf3bd8 100755 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -12,7 +12,7 @@ * */ -// import { pagedPosts, pagedJobs, pagedVideos, pagedRepos } from './paged' +// import { pagedPosts, pagedJobs, pagedRepos } from './paged' export { default as F } from './fragments' export { default as P } from './pages' diff --git a/src/schemas/pages/index.ts b/src/schemas/pages/index.ts index 5903fe55d..13925eafd 100755 --- a/src/schemas/pages/index.ts +++ b/src/schemas/pages/index.ts @@ -1,6 +1,5 @@ import { pagedPosts, post } from './post' import { pagedJobs, job } from './job' -import { pagedVideos, video } from './video' import { pagedRepos, repo } from './repo' import { user, sessionState } from './user' import { community, subscribedCommunities, pagedCommunities } from './community' @@ -35,9 +34,6 @@ const P = { // job pagedJobs, job, - // video - pagedVideos, - video, // repo pagedRepos, repo, diff --git a/src/schemas/pages/misc.ts b/src/schemas/pages/misc.ts index 961e992af..13eaa5fef 100755 --- a/src/schemas/pages/misc.ts +++ b/src/schemas/pages/misc.ts @@ -1,8 +1,8 @@ import F from '../fragments' export const partialTags = ` - query($communityId: ID, $community: String, $thread: CmsThread!, $topic: String) { - partialTags(communityId: $communityId, community: $community, thread: $thread, topic: $topic) { + query($communityId: ID, $community: String, $thread: CmsThread!) { + partialTags(communityId: $communityId, community: $community, thread: $thread) { ${F.tag} } } diff --git a/src/schemas/pages/video.ts b/src/schemas/pages/video.ts deleted file mode 100755 index 4bc9759f8..000000000 --- a/src/schemas/pages/video.ts +++ /dev/null @@ -1,56 +0,0 @@ -import F from '../fragments' - -export const video = ` - query($id: ID!) { - video(id: $id) { - ${F.video} - link - author { - ${F.author} - bio - location - achievement { - reputation - } - followersCount - followingsCount - } - favoritedCount - starredCount - - pagedCommentsParticipators { - entries { - ${F.author} - } - totalCount - } - origialCommunity { - ${F.community} - } - communities { - ${F.community} - } - tags { - ${F.tag} - } - } - } -` -export const pagedVideos = ` - query($filter: PagedVideosFilter, $userHasLogin: Boolean!) { - pagedVideos(filter: $filter) { - entries { - ${F.video} - pin - author { - ${F.author} - } - tags { - ${F.tag} - } - viewerHasViewed @include(if: $userHasLogin) - } - ${F.pagedCounts} - } - } -` diff --git a/src/stores/RootStore/index.ts b/src/stores/RootStore/index.ts index bacfcfa98..2152c8a80 100755 --- a/src/stores/RootStore/index.ts +++ b/src/stores/RootStore/index.ts @@ -35,7 +35,6 @@ import { // threads PostsThreadStore, - VideosThreadStore, ReposThreadStore, WikiThreadStore, JobsThreadStore, @@ -48,7 +47,6 @@ import { CommunityContentStore, PostContentStore, JobContentStore, - VideoContentStore, RepoContentStore, DiscoveryContentStore, CommunityEditorStore, @@ -60,7 +58,6 @@ import { JobViewerStore, ArticleViewerHeader, ArticleBodyHeaderStore, - VideoViewerStore, RepoViewerStore, CommentsStore, MailsViewerStore, @@ -71,7 +68,6 @@ import { SidebarStore, PostEditorStore, JobEditorStore, - VideoEditorStore, RepoEditorStore, AccountEditorStore, MailBoxStore, @@ -142,7 +138,6 @@ const rootStore = T.model({ doraemon: T.optional(DoraemonStore, {}), jobEditor: T.optional(JobEditorStore, {}), postEditor: T.optional(PostEditorStore, {}), - videoEditor: T.optional(VideoEditorStore, {}), repoEditor: T.optional(RepoEditorStore, {}), accountEditor: T.optional(AccountEditorStore, {}), mailBox: T.optional(MailBoxStore, {}), @@ -171,7 +166,6 @@ const rootStore = T.model({ communityEditor: T.optional(CommunityEditorStore, {}), postContent: T.optional(PostContentStore, {}), jobContent: T.optional(JobContentStore, {}), - videoContent: T.optional(VideoContentStore, {}), repoContent: T.optional(RepoContentStore, {}), userContent: T.optional(UserContentStore, {}), // content end @@ -180,7 +174,6 @@ const rootStore = T.model({ footer: T.optional(FooterStore, {}), // threads postsThread: T.optional(PostsThreadStore, {}), - videosThread: T.optional(VideosThreadStore, {}), reposThread: T.optional(ReposThreadStore, {}), wikiThread: T.optional(WikiThreadStore, {}), jobsThread: T.optional(JobsThreadStore, {}), @@ -199,7 +192,6 @@ const rootStore = T.model({ // viewers (for drawer usage) postViewer: T.optional(PostViewerStore, {}), jobViewer: T.optional(JobViewerStore, {}), - videoViewer: T.optional(VideoViewerStore, {}), repoViewer: T.optional(RepoViewerStore, {}), mailsViewer: T.optional(MailsViewerStore, {}), diff --git a/src/stores/SharedModel/Comment.ts b/src/stores/SharedModel/Comment.ts index 2ac3979fa..f5c44b163 100755 --- a/src/stores/SharedModel/Comment.ts +++ b/src/stores/SharedModel/Comment.ts @@ -89,28 +89,6 @@ export const PagedJobComments = T.model('PagedJobComment', { totalPages: T.optional(T.number, 0), }) -// paged videos comemnts -const VideoBrief = T.model('VideoBrief', { - id: T.maybeNull(T.string), - title: T.maybeNull(T.string), - author: T.maybeNull(User), - commentsCount: T.maybeNull(T.number), - communities: T.optional(T.array(Community), []), - origialCommunity: T.optional(Community, {}), -}) - -const VideoComment = T.model('VideoComment', { - ...CommentBase, - video: T.optional(VideoBrief, {}), -}) -export const PagedVideoComments = T.model('PagedVideoComment', { - entries: T.optional(T.array(VideoComment), []), - pageNumber: T.optional(T.number, 1), - pageSize: T.optional(T.number, PAGE_SIZE.D), - totalCount: T.optional(T.number, 0), - totalPages: T.optional(T.number, 0), -}) - // paged repos comemnts const RepoBrief = T.model('RepoBrief', { id: T.maybeNull(T.string), diff --git a/src/stores/SharedModel/ContentFilter.ts b/src/stores/SharedModel/ContentFilter.ts index d9c4e29f8..68ceca5c5 100755 --- a/src/stores/SharedModel/ContentFilter.ts +++ b/src/stores/SharedModel/ContentFilter.ts @@ -38,7 +38,6 @@ export const ContentFilter = T.model('ContentFilter', { field: T.optional(T.string, ''), finance: T.optional(T.string, ''), scale: T.optional(T.string, ''), - // video source: T.optional(T.string, ''), read: T.optional(T.enumeration('read', ['', FILTER.READ, FILTER.UNREAD]), ''), }) diff --git a/src/stores/SharedModel/Video.ts b/src/stores/SharedModel/Video.ts deleted file mode 100755 index b3b6fa92b..000000000 --- a/src/stores/SharedModel/Video.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { types as T } from 'mobx-state-tree' - -import { PAGE_SIZE } from '@/config' - -import { User, PagedUsers } from './User' -import { Community } from './Community' -/* import { Comment } from './Comment' */ -import { Tag } from './Tag' - -export const Video = T.model('Video', { - id: T.maybeNull(T.string), - title: T.maybeNull(T.string), - desc: T.maybeNull(T.string), - duration: T.maybeNull(T.string), - /* durationDec: T.maybeNull(T.number), */ - thumbnil: T.maybeNull(T.string), - poster: T.maybeNull(T.string), - author: T.maybeNull(User), - - source: T.maybeNull(T.string), - link: T.maybeNull(T.string), - originalAuthor: T.maybeNull(T.string), - originalAuthorLink: T.maybeNull(T.string), - - views: T.optional(T.number, 0), - pin: T.maybeNull(T.boolean), - - communities: T.optional(T.array(Community), []), - origialCommunity: T.optional(Community, {}), - tags: T.optional(T.array(Tag), []), - /* comments: T.optional(T.array(Comment), []), */ - favoritedCount: T.optional(T.number, 0), - starredCount: T.optional(T.number, 0), - viewerHasFavorited: T.optional(T.boolean, false), - viewerHasStarred: T.optional(T.boolean, false), - favoritedCategoryId: T.maybeNull(T.string), - - pagedCommentsParticipators: T.optional(PagedUsers, {}), - - publishAt: T.maybeNull(T.string), - - viewerHasViewed: T.optional(T.boolean, false), - - insertedAt: T.optional(T.string, ''), - updatedAt: T.optional(T.string, ''), -}) - -export const PagedVideos = T.model('PagedVideos', { - entries: T.optional(T.array(Video), []), - pageNumber: T.optional(T.number, 1), - pageSize: T.optional(T.number, PAGE_SIZE.D), - totalCount: T.optional(T.number, 0), - totalPages: T.optional(T.number, 0), -}) diff --git a/src/stores/SharedModel/index.ts b/src/stores/SharedModel/index.ts index 5ff14615f..a23d6df61 100755 --- a/src/stores/SharedModel/index.ts +++ b/src/stores/SharedModel/index.ts @@ -7,11 +7,9 @@ export { PagedComments, PagedPostComments, PagedJobComments, - PagedVideoComments, PagedRepoComments, } from './Comment' export { Post, PagedPosts } from './Post' -export { Video, PagedVideos } from './Video' export { Repo, PagedRepos } from './Repo' export { Job, PagedJobs } from './Job' export { Tag, PagedTags } from './Tag' diff --git a/src/stores/ViewingStore/index.ts b/src/stores/ViewingStore/index.ts index 58a842694..8b1e75d85 100755 --- a/src/stores/ViewingStore/index.ts +++ b/src/stores/ViewingStore/index.ts @@ -9,19 +9,18 @@ import { values, merge } from 'ramda' import type { TRootStore, TUser, TArticle, TThread, TAccount } from '@/spec' import { THREAD } from '@/constant' import { markStates, buildLog, stripMobx } from '@/utils' -import { User, Community, Post, Job, Video, Repo } from '@/model' +import { User, Community, Post, Job, Repo } from '@/model' /* eslint-disable-next-line */ const log = buildLog('S:ViewingStore') -const PREVIEWABLE_THREADS = [THREAD.POST, THREAD.JOB, THREAD.VIDEO, THREAD.REPO] +const PREVIEWABLE_THREADS = [THREAD.POST, THREAD.JOB, THREAD.REPO] const ViewingStore = T.model('ViewingStore', { user: T.optional(User, {}), community: T.optional(Community, {}), post: T.optional(Post, {}), job: T.optional(Job, {}), - video: T.optional(Video, {}), repo: T.optional(Repo, {}), activeThread: T.optional( T.enumeration('activeThread', values(THREAD)), @@ -56,8 +55,6 @@ const ViewingStore = T.model('ViewingStore', { return stripMobx(self.job) case THREAD.REPO: return stripMobx(self.repo) - case THREAD.VIDEO: - return stripMobx(self.video) default: return stripMobx(self.post) } @@ -98,9 +95,6 @@ const ViewingStore = T.model('ViewingStore', { case THREAD.REPO: root.reposThread.updateItem(item) return - case THREAD.VIDEO: - root.videosThread.updateItem(item) - return default: { root.postsThread.updateItem(item) } diff --git a/src/stores/index.ts b/src/stores/index.ts index b40933003..9faf9f1de 100755 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -45,7 +45,6 @@ export { default as CommunityContentStore } from '@/containers/content/Community export { default as DiscoveryContentStore } from '@/containers/content/DiscoveryContent/store' export { default as PostContentStore } from '@/containers/content/PostContent/store' export { default as JobContentStore } from '@/containers/content/JobContent/store' -export { default as VideoContentStore } from '@/containers/content/VideoContent/store' export { default as RepoContentStore } from '@/containers/content/RepoContent/store' export { default as UserContentStore } from '@/containers/content/UserContent/store' @@ -54,7 +53,6 @@ export { default as FooterStore } from '@/containers/unit/Footer/store' // threads store export { default as PostsThreadStore } from '@/containers/thread/PostsThread/store' -export { default as VideosThreadStore } from '@/containers/thread/VideosThread/store' export { default as ReposThreadStore } from '@/containers/thread/ReposThread/store' export { default as WikiThreadStore } from '@/containers/thread/WikiThread/store' export { default as JobsThreadStore } from '@/containers/thread/JobsThread/store' @@ -68,7 +66,6 @@ export { default as TagsBarStore } from '@/containers/unit/TagsBar/store' export { default as DocUploaderStore } from '@/containers/tool/DocUploader/store' export { default as JobEditorStore } from '@/containers/editor/JobEditor/store' export { default as PostEditorStore } from '@/containers/editor/PostEditor/store' -export { default as VideoEditorStore } from '@/containers/editor/VideoEditor/store' export { default as RepoEditorStore } from '@/containers/editor/RepoEditor/store' export { default as CommentsStore } from '@/containers/unit/Comments/store' export { default as AccountEditorStore } from '@/containers/editor/AccountEditor/store' @@ -78,7 +75,6 @@ export { default as CommunitySetterStore } from '@/containers/tool/CommunitySett // viewers store export { default as PostViewerStore } from '@/containers/viewer/PostViewer/store' export { default as JobViewerStore } from '@/containers/viewer/JobViewer/store' -export { default as VideoViewerStore } from '@/containers/viewer/VideoViewer/store' export { default as RepoViewerStore } from '@/containers/viewer/RepoViewer/store' export { default as MailsViewerStore } from '@/containers/viewer/MailsViewer/store' diff --git a/utils/constant/event.ts b/utils/constant/event.ts index 1a7c26fe8..9910b9b86 100755 --- a/utils/constant/event.ts +++ b/utils/constant/event.ts @@ -26,7 +26,6 @@ const EVENT = { REFRESH_POSTS: 'REFRESH_POSTS', REFRESH_REPOS: 'REFRESH_REPOS', REFRESH_JOBS: 'REFRESH_JOBS', - REFRESH_VIDEOS: 'REFRESH_VIDEOS', REFRESH_REACTIONS: 'REFRESH_REACTIONS', // sync repo SYNC_REPO: 'SYNC_REPO', diff --git a/utils/constant/route.ts b/utils/constant/route.ts index 0b004d714..b2ebca03b 100755 --- a/utils/constant/route.ts +++ b/utils/constant/route.ts @@ -7,7 +7,6 @@ const ROUTE = { CHEATSHEETS: 'cheatsheets', POSTS: 'posts', JOBS: 'jobs', - VIDEOS: 'videos', USERS: 'users', REPOS: 'repos', WIKI: 'wiki', @@ -19,7 +18,6 @@ const ROUTE = { POST: 'post', USER: 'user', JOB: 'job', - VIDEO: 'video', REPO: 'repo', MEETUPS: 'meetups', diff --git a/utils/constant/thread.ts b/utils/constant/thread.ts index 42f837854..13f9e798d 100755 --- a/utils/constant/thread.ts +++ b/utils/constant/thread.ts @@ -1,16 +1,6 @@ -/* const MAJOR_COMMUNITY_THREAD = { - USER: 'user', - JOB: 'job', - VIDEO: 'video', - REPO: 'repo', - WIKI: 'wiki', - CHEATSHEET: 'cheatsheet', -} */ - export const COMMUNITY_SPEC_THREADS = { USER: 'user', JOB: 'job', - VIDEO: 'video', REPO: 'repo', WIKI: 'wiki', CHEATSHEET: 'cheatsheet', diff --git a/utils/constant/type.ts b/utils/constant/type.ts index b08d9fe9a..a8afe6ec2 100755 --- a/utils/constant/type.ts +++ b/utils/constant/type.ts @@ -12,7 +12,6 @@ const TYPE = { POST: 'POST', JOB: 'JOB', REPO: 'REPO', - VIDEO: 'VIDEO', // actions FAVORITE: 'FAVORITE', STAR: 'STAR', @@ -47,10 +46,6 @@ const TYPE = { REPO_VIEW: 'REPO_VIEW', REPO_CREATE: 'REPO_CREATE', - VIDEO_VIEW: 'VIDEO_VIEW', - VIDEO_CREATE: 'VIDEO_CREATE', - VIDEO_EDIT: 'VIDEO_EDIT', - // c11n settings C11N_SETTINGS: 'C11N_SETTINGS', diff --git a/utils/i18n/index.js b/utils/i18n/index.js index b6ebed143..ae11a41dd 100755 --- a/utils/i18n/index.js +++ b/utils/i18n/index.js @@ -10,8 +10,6 @@ const I18nDict = { city: '同城', share: '分享', users: '用户', - videos: '视频', - video: '视频', repos: '开源项目', repo: '开源项目', jobs: '招聘', diff --git a/utils/route.js b/utils/route.js index 088ae9655..ad5cfb392 100755 --- a/utils/route.js +++ b/utils/route.js @@ -326,13 +326,11 @@ const TR_MAP = { posts: 'post', users: 'user', jobs: 'job', - videos: 'video', repos: 'repo', post: 'posts', user: 'users', job: 'jobs', - video: 'videos', repo: 'repos', /* wiki: 'wiki', */ diff --git a/utils/ssr.js b/utils/ssr.js index 819355aac..21ba7e423 100755 --- a/utils/ssr.js +++ b/utils/ssr.js @@ -34,9 +34,6 @@ export const ssrPagedSchema = (thread) => { case THREAD.JOB: return P.pagedJobs - case THREAD.VIDEO: - return P.pagedVideos - case THREAD.REPO: return P.pagedRepos @@ -92,16 +89,6 @@ export const ssrContentsThread = (resp, thread, filters = {}) => { }, } - case THREAD.VIDEO: - return { - videosThread: { - pagedVideos: resp.pagedVideos, - curView: getCurView(resp.pagedVideos), - activeTag, - filters, - }, - } - case THREAD.REPO: return { reposThread: { @@ -144,7 +131,7 @@ export const ssrContentsThread = (resp, thread, filters = {}) => { // TODO generl export const addTopicIfNeed = (source, thread, topic) => { - if (!contains(thread, ['JOB', 'VIDEO', 'REPO', 'USER', 'WIKI'])) { + if (!contains(thread, ['JOB', 'REPO', 'USER', 'WIKI'])) { return merge(source, { topic }) } return source @@ -167,7 +154,6 @@ export const validCommunityFilters = [ 'finance', 'scale', 'education', - // videos 'source', ]