Skip to content

Commit

Permalink
feat: some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gouravmpk committed Dec 23, 2023
1 parent d8b532e commit 0387653
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/AddContentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ const handleSubmitForm = async (
if (sourceType === LINK) {
body.media_url = data.source

body.content_type === 'audio_video'
const twitterBroadcastRegex = /https:\/\/twitter\.com\/i\/broadcasts\/\w+/

if (twitterBroadcastRegex.test(data.source)) {
body.content_type = 'audio_video'
}
} else if (sourceType === TWITTER_SOURCE) {
const regex = /(?:https?:\/\/)?(?:www\.)?twitter\.com\/\w+\/status\/\d+/s

Expand Down
4 changes: 2 additions & 2 deletions src/components/AddContentModal/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AUDIO_VIDEO, DOCUMENT, LINK, TWITTER_HANDLE, TWITTER_SOURCE, WEB_PAGE, YOUTUBE_CHANNEL } from '~/constants'
import { DOCUMENT, LINK, TWITTER_HANDLE, TWITTER_SOURCE, WEB_PAGE, YOUTUBE_CHANNEL } from '~/constants'

export const twitterHandlePattern = /\btwitter\.com\/(?:@)?([\w_]+)(?:$|\?[^/]*$)/

Expand All @@ -25,7 +25,7 @@ export function getInputType(source: string) {
} else if (tweetUrlRegex.test(source)) {
inputType = TWITTER_SOURCE
} else if (twitterBroadcastRegex.test(source)) {
inputType = AUDIO_VIDEO
inputType = LINK
} else if (genericUrlRegex.test(source)) {
inputType = WEB_PAGE
}
Expand Down
1 change: 0 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const RSS = 'rss'
export const TWITTER_SOURCE = 'tweet'
export const TOPIC = 'topic'
export const DOCUMENT = 'document'
export const AUDIO_VIDEO = 'audio_video'
export const isE2E = !!import.meta.env.VITE_APP_IS_E2E

export const requiredRule = {
Expand Down

0 comments on commit 0387653

Please sign in to comment.