diff --git a/apps/frontend/src/components/launches/editor.tsx b/apps/frontend/src/components/launches/editor.tsx index 5e8e4755..8d7d4ba2 100644 --- a/apps/frontend/src/components/launches/editor.tsx +++ b/apps/frontend/src/components/launches/editor.tsx @@ -36,7 +36,6 @@ export const Editor = forwardRef< }, ], handler: async ({ content }) => { - console.log('editPost_' + props.order, content, dayjs().unix()); props?.onChange?.(content); }, }); diff --git a/apps/frontend/src/components/launches/polonto.tsx b/apps/frontend/src/components/launches/polonto.tsx index 763f9aef..5675fa27 100644 --- a/apps/frontend/src/components/launches/polonto.tsx +++ b/apps/frontend/src/components/launches/polonto.tsx @@ -72,7 +72,6 @@ const Polonto: FC<{ const { setMedia, type, closeModal } = props; const user = useUser(); - console.log(user); const features = useMemo(() => { return [ ...DEFAULT_SECTIONS, diff --git a/apps/frontend/src/components/launches/providers/bluesky/bluesky.provider.tsx b/apps/frontend/src/components/launches/providers/bluesky/bluesky.provider.tsx index 033afe59..2cf549c1 100644 --- a/apps/frontend/src/components/launches/providers/bluesky/bluesky.provider.tsx +++ b/apps/frontend/src/components/launches/providers/bluesky/bluesky.provider.tsx @@ -1,11 +1,6 @@ -import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -const Empty: FC = (props) => { - return null; -}; - -export default withProvider(null, Empty, undefined, async (posts) => { +export default withProvider(null, undefined, undefined, async (posts) => { if (posts.some((p) => p.length > 4)) { return 'There can be maximum 4 pictures in a post.'; } diff --git a/apps/frontend/src/components/launches/providers/discord/discord.provider.tsx b/apps/frontend/src/components/launches/providers/discord/discord.provider.tsx index 86f00438..2c22647a 100644 --- a/apps/frontend/src/components/launches/providers/discord/discord.provider.tsx +++ b/apps/frontend/src/components/launches/providers/discord/discord.provider.tsx @@ -4,10 +4,6 @@ import { DiscordDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-setti import { DiscordChannelSelect } from '@gitroom/frontend/components/launches/providers/discord/discord.channel.select'; import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values'; -const Empty: FC = () => { - return null; -}; - const DiscordComponent: FC = () => { const form = useSettings(); return ( @@ -18,7 +14,7 @@ const DiscordComponent: FC = () => { }; export default withProvider( DiscordComponent, - Empty, + undefined, DiscordDto, undefined, 280 diff --git a/apps/frontend/src/components/launches/providers/dribbble/dribbble.provider.tsx b/apps/frontend/src/components/launches/providers/dribbble/dribbble.provider.tsx index 9a0741ed..3ab19212 100644 --- a/apps/frontend/src/components/launches/providers/dribbble/dribbble.provider.tsx +++ b/apps/frontend/src/components/launches/providers/dribbble/dribbble.provider.tsx @@ -1,18 +1,9 @@ import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values'; import { Input } from '@gitroom/react/form/input'; import { DribbbleTeams } from '@gitroom/frontend/components/launches/providers/dribbble/dribbble.teams'; import { DribbbleDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/dribbble.dto'; -import ImageFile from 'next/image'; const DribbbleSettings: FC = () => { const { register, control } = useSettings(); @@ -23,128 +14,10 @@ const DribbbleSettings: FC = () => { ); }; -const DribbblePreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- - -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
-
-
-        {!!firstPost?.images?.length && (
-          
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
- {morePosts.map((p, index) => ( -
-
- - -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; export default withProvider( DribbbleSettings, - DribbblePreview, + undefined, DribbbleDto, async ([firstItem, ...otherItems]) => { const isMp4 = firstItem?.find((item) => item.path.indexOf('mp4') > -1); diff --git a/apps/frontend/src/components/launches/providers/facebook/facebook.provider.tsx b/apps/frontend/src/components/launches/providers/facebook/facebook.provider.tsx index 1d44c81b..8d2342d2 100644 --- a/apps/frontend/src/components/launches/providers/facebook/facebook.provider.tsx +++ b/apps/frontend/src/components/launches/providers/facebook/facebook.provider.tsx @@ -1,132 +1,3 @@ -import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; -import Image from 'next/image'; -const FacebookPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
-
-
-        {!!firstPost?.images?.length && (
-          
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
- {morePosts.map((p, index) => ( -
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; - -export default withProvider(null, FacebookPreview, undefined, undefined, 63206); +export default withProvider(null, undefined, undefined, undefined, 63206); diff --git a/apps/frontend/src/components/launches/providers/high.order.provider.tsx b/apps/frontend/src/components/launches/providers/high.order.provider.tsx index 07b90812..dd754a3f 100644 --- a/apps/frontend/src/components/launches/providers/high.order.provider.tsx +++ b/apps/frontend/src/components/launches/providers/high.order.provider.tsx @@ -70,9 +70,11 @@ export const EditorWrapper: FC<{ children: ReactNode }> = ({ children }) => { export const withProvider = ( SettingsComponent: FC | null, - PreviewComponent: FC, + CustomPreviewComponent?: FC<{maximumCharacters?: number}>, dto?: any, - checkValidity?: (value: Array>) => Promise, + checkValidity?: ( + value: Array> + ) => Promise, maximumCharacters?: number ) => { return (props: { @@ -89,8 +91,11 @@ export const withProvider = ( const existingData = useExistingData(); const { integration, date } = useIntegration(); useCopilotReadable({ - description: integration?.type === 'social' ? 'force content always in MD format' : 'force content always to be fit to social media', - value: '' + description: + integration?.type === 'social' + ? 'force content always in MD format' + : 'force content always to be fit to social media', + value: '', }); const [editInPlace, setEditInPlace] = useState(!!existingData.integration); const [InPlaceValue, setInPlaceValue] = useState< @@ -116,11 +121,15 @@ export const withProvider = ( }, [SettingsComponent]); // in case there is an error on submit, we change to the settings tab for the specific provider - useMoveToIntegrationListener([props.id], true, ({identifier, toPreview}) => { - if (identifier === props.id) { - setShowTab(toPreview ? 1 : 2); + useMoveToIntegrationListener( + [props.id], + true, + ({ identifier, toPreview }) => { + if (identifier === props.id) { + setShowTab(toPreview ? 1 : 2); + } } - }); + ); // this is a smart function, it updates the global value without updating the states (too heavy) and set the settings validation const form = useValues( @@ -234,8 +243,12 @@ export const withProvider = ( }, [props.value, editInPlace]); useCopilotAction({ - name: editInPlace ? 'switchToGlobalEdit' : `editInPlace_${integration?.identifier}`, - description: editInPlace ? 'Switch to global editing' : `Edit only ${integration?.identifier} this, if you want a different identifier, you have to use setSelectedIntegration first`, + name: editInPlace + ? 'switchToGlobalEdit' + : `editInPlace_${integration?.identifier}`, + description: editInPlace + ? 'Switch to global editing' + : `Edit only ${integration?.identifier} this, if you want a different identifier, you have to use setSelectedIntegration first`, handler: async () => { await changeToEditor(); }, @@ -281,7 +294,11 @@ export const withProvider = ( secondary={showTab !== 1} onClick={changeToEditor} > - {editInPlace ? 'Edit globally' : `Edit only ${integration?.name} (${capitalize(integration?.identifier.replace('-', ' '))})`} + {editInPlace + ? 'Edit globally' + : `Edit only ${integration?.name} (${capitalize( + integration?.identifier.replace('-', ' ') + )})`} @@ -292,7 +309,8 @@ export const withProvider = (
{!existingData?.integration && (
- You are now editing only {integration?.name} ({capitalize(integration?.identifier.replace('-', ' '))}) + You are now editing only {integration?.name} ( + {capitalize(integration?.identifier.replace('-', ' '))})
)} {InPlaceValue.map((val, index) => ( @@ -384,7 +402,7 @@ export const withProvider = ( document.querySelector('#renderEditor')! )} {(showTab === 0 || showTab === 2) && ( -
+
)} @@ -400,7 +418,15 @@ export const withProvider = ( {(editInPlace ? InPlaceValue : props.value) .map((p) => p.content) .join('').length ? ( - + CustomPreviewComponent ? ( + + ) : ( + + ) ) : ( <>No Content Yet )} diff --git a/apps/frontend/src/components/launches/providers/instagram/instagram.provider.tsx b/apps/frontend/src/components/launches/providers/instagram/instagram.provider.tsx index 7c7e4def..8c12e352 100644 --- a/apps/frontend/src/components/launches/providers/instagram/instagram.provider.tsx +++ b/apps/frontend/src/components/launches/providers/instagram/instagram.provider.tsx @@ -1,136 +1,8 @@ -import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; -import Image from 'next/image'; - -const InstagramPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
- {!!firstPost?.images?.length && ( -
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
-      
- {morePosts.map((p, index) => ( -
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; export default withProvider( null, - InstagramPreview, + undefined, undefined, async ([firstPost, ...otherPosts]) => { if (!firstPost.length) { diff --git a/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx b/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx index 4cd21bc2..3be3b143 100644 --- a/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx +++ b/apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx @@ -1,132 +1,3 @@ -import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; -import Image from 'next/image'; -const LinkedinPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
-
-
-        {!!firstPost?.images?.length && (
-          
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
- {morePosts.map((p, index) => ( -
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; - -export default withProvider(null, LinkedinPreview, undefined, undefined, 3000); +export default withProvider(null, undefined, undefined, undefined, 1300); diff --git a/apps/frontend/src/components/launches/providers/mastodon/mastodon.provider.tsx b/apps/frontend/src/components/launches/providers/mastodon/mastodon.provider.tsx index 901ea78e..08680e28 100644 --- a/apps/frontend/src/components/launches/providers/mastodon/mastodon.provider.tsx +++ b/apps/frontend/src/components/launches/providers/mastodon/mastodon.provider.tsx @@ -1,8 +1,3 @@ import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; - -const Empty: FC = (props) => { - return null; -}; - -export default withProvider(null, Empty, undefined, undefined); +export default withProvider(null, undefined, undefined, undefined); diff --git a/apps/frontend/src/components/launches/providers/pinterest/pinterest.provider.tsx b/apps/frontend/src/components/launches/providers/pinterest/pinterest.provider.tsx index 46a88d51..01b73cbf 100644 --- a/apps/frontend/src/components/launches/providers/pinterest/pinterest.provider.tsx +++ b/apps/frontend/src/components/launches/providers/pinterest/pinterest.provider.tsx @@ -1,19 +1,10 @@ import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values'; import { PinterestBoard } from '@gitroom/frontend/components/launches/providers/pinterest/pinterest.board'; import { PinterestSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/pinterest.dto'; import { Input } from '@gitroom/react/form/input'; import { ColorPicker } from '@gitroom/react/form/color.picker'; -import ImageFile from 'next/image'; const PinterestSettings: FC = () => { const { register, control } = useSettings(); @@ -30,128 +21,10 @@ const PinterestSettings: FC = () => {
); }; -const PinterestPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- - -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
-
-
-        {!!firstPost?.images?.length && (
-          
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
- {morePosts.map((p, index) => ( -
-
- - -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; export default withProvider( PinterestSettings, - PinterestPreview, + undefined, PinterestSettingsDto, async ([firstItem, ...otherItems]) => { const isMp4 = firstItem?.find((item) => item.path.indexOf('mp4') > -1); diff --git a/apps/frontend/src/components/launches/providers/slack/slack.provider.tsx b/apps/frontend/src/components/launches/providers/slack/slack.provider.tsx index 90857a87..bb58ac13 100644 --- a/apps/frontend/src/components/launches/providers/slack/slack.provider.tsx +++ b/apps/frontend/src/components/launches/providers/slack/slack.provider.tsx @@ -4,10 +4,6 @@ import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.v import { SlackChannelSelect } from '@gitroom/frontend/components/launches/providers/slack/slack.channel.select'; import { SlackDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/slack.dto'; -const Empty: FC = () => { - return null; -}; - const SlackComponent: FC = () => { const form = useSettings(); return ( @@ -18,7 +14,7 @@ const SlackComponent: FC = () => { }; export default withProvider( SlackComponent, - Empty, + undefined, SlackDto, undefined, 280 diff --git a/apps/frontend/src/components/launches/providers/threads/threads.provider.tsx b/apps/frontend/src/components/launches/providers/threads/threads.provider.tsx index 775bff8a..63c74de9 100644 --- a/apps/frontend/src/components/launches/providers/threads/threads.provider.tsx +++ b/apps/frontend/src/components/launches/providers/threads/threads.provider.tsx @@ -1,138 +1,10 @@ -import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; -import Image from 'next/image'; - -const ThreadsPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
- {!!firstPost?.images?.length && ( -
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
-      
- {morePosts.map((p, index) => ( -
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; export default withProvider( null, - ThreadsPreview, undefined, - async ([firstPost, ...otherPosts]) => { + undefined, + async () => { return true; }, 500 diff --git a/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx b/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx index d591299f..3d3e2b06 100644 --- a/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx +++ b/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx @@ -1,17 +1,8 @@ import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; import { TikTokDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/tiktok.dto'; import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values'; import { Select } from '@gitroom/react/form/select'; -import Image from 'next/image'; const privacyLevel = [ { @@ -137,128 +128,9 @@ const TikTokSettings: FC = () => { ); }; -const TikTokPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
-
-
-        {!!firstPost?.images?.length && (
-          
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
- {morePosts.map((p, index) => ( -
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; - export default withProvider( TikTokSettings, - TikTokPreview, + undefined, TikTokDto, async (items) => { const [firstItems] = items; diff --git a/apps/frontend/src/components/launches/providers/x/x.provider.tsx b/apps/frontend/src/components/launches/providers/x/x.provider.tsx index 3e0cec02..0a517836 100644 --- a/apps/frontend/src/components/launches/providers/x/x.provider.tsx +++ b/apps/frontend/src/components/launches/providers/x/x.provider.tsx @@ -1,108 +1,5 @@ -import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import localFont from 'next/font/local'; -import clsx from 'clsx'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; - -const chirp = localFont({ - src: [ - { - path: './fonts/Chirp-Regular.woff2', - weight: '400', - style: 'normal', - }, - { - path: './fonts/Chirp-Bold.woff2', - weight: '700', - style: 'normal', - }, - ], -}); - -const XPreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - specialFunc: (text: string) => { - return text.slice(0, 280); - }, - }); - - return ( -
-
- {newValues.map((value, index) => ( -
-
- x - {index !== topValue.length - 1 && ( -
- )} -
-
-
-
- {integration?.name} -
-
- - - - - -
-
- @username -
-
-
-                {value.text}
-              
- {!!value?.images?.length && ( -
- {value.images.map((image, index) => ( - - - - ))} -
- )} -
-
- ))} -
-
- ); -}; - -export default withProvider(null, XPreview, undefined, async (posts) => { +export default withProvider(null, undefined, undefined, async (posts) => { if (posts.some(p => p.length > 4)) { return 'There can be maximum 4 pictures in a post.'; } diff --git a/apps/frontend/src/components/launches/providers/youtube/youtube.provider.tsx b/apps/frontend/src/components/launches/providers/youtube/youtube.provider.tsx index fc30737a..a0859429 100644 --- a/apps/frontend/src/components/launches/providers/youtube/youtube.provider.tsx +++ b/apps/frontend/src/components/launches/providers/youtube/youtube.provider.tsx @@ -1,20 +1,11 @@ import { FC } from 'react'; import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; -import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; -import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; -import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; -import { - afterLinkedinCompanyPreventRemove, - linkedinCompanyPreventRemove, -} from '@gitroom/helpers/utils/linkedin.company.prevent.remove'; -import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; import { YoutubeSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/youtube.settings.dto'; import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values'; import { Input } from '@gitroom/react/form/input'; import { MediumTags } from '@gitroom/frontend/components/launches/providers/medium/medium.tags'; import { MediaComponent } from '@gitroom/frontend/components/media/media.component'; import { Select } from '@gitroom/react/form/select'; -import Image from 'next/image'; const type = [ { label: 'Public', value: 'public' }, @@ -48,128 +39,10 @@ const YoutubeSettings: FC = () => {
); }; -const YoutubePreview: FC = (props) => { - const { value: topValue, integration } = useIntegration(); - const mediaDir = useMediaDirectory(); - const newValues = useFormatting(topValue, { - removeMarkdown: true, - saveBreaklines: true, - beforeSpecialFunc: (text: string) => { - return linkedinCompanyPreventRemove(text); - }, - specialFunc: (text: string) => { - return afterLinkedinCompanyPreventRemove(text.slice(0, 280)); - }, - }); - - const [firstPost, ...morePosts] = newValues; - if (!firstPost) { - return null; - } - - return ( -
-
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
1m
-
-
-
-
-
-        {!!firstPost?.images?.length && (
-          
- {firstPost.images.map((image, index) => ( - - - - ))} -
- )} -
- {morePosts.map((p, index) => ( -
-
- x - x -
-
-
{integration?.name}
-
- CEO @ Gitroom -
-
- {p.text} -
- - {!!p?.images?.length && ( -
- {p.images.map((image, index) => ( - -
- -
-
- ))} -
- )} -
-
- ))} -
- ); -}; export default withProvider( YoutubeSettings, - YoutubePreview, + undefined, YoutubeSettingsDto, async (items) => { const [firstItems] = items; diff --git a/apps/frontend/src/components/layout/mode.component.tsx b/apps/frontend/src/components/layout/mode.component.tsx index 85abe51a..fac44716 100644 --- a/apps/frontend/src/components/layout/mode.component.tsx +++ b/apps/frontend/src/components/layout/mode.component.tsx @@ -10,7 +10,6 @@ const ModeComponent = () => { }, [mode]); useEffect(() => { - console.log(mode); document.body.classList.remove('dark', 'light'); document.body.classList.add(mode); }, [mode]); diff --git a/libraries/nestjs-libraries/src/database/prisma/stars/stars.service.ts b/libraries/nestjs-libraries/src/database/prisma/stars/stars.service.ts index fd8130ec..96a9dbb7 100644 --- a/libraries/nestjs-libraries/src/database/prisma/stars/stars.service.ts +++ b/libraries/nestjs-libraries/src/database/prisma/stars/stars.service.ts @@ -61,7 +61,6 @@ export class StarsService { ...new Set([...Object.keys(loadAllStars), ...Object.keys(loadAllForks)]), ]; - console.log(allDates); const sortedArray = allDates.sort( (a, b) => dayjs(a).unix() - dayjs(b).unix() ); diff --git a/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts b/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts index d03ea417..daba05a2 100644 --- a/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/discord.provider.ts @@ -118,8 +118,6 @@ export class DiscordProvider extends SocialAbstract implements SocialProvider { }) ).json(); - console.log(list); - return list .filter((p: any) => p.type === 0 || p.type === 15) .map((p: any) => ({ diff --git a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts index 3e2d84b8..e419e5c0 100644 --- a/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts @@ -173,8 +173,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider { let finalId = ''; let finalUrl = ''; - if ((firstPost?.media?.[0]?.path?.indexOf('mp4') || -2) > -1) { - console.log('mp4'); + if ((firstPost?.media?.[0]?.url?.indexOf('mp4') || -2) > -1) { const { id: videoId, permalink_url, ...all } = await ( await this.fetch( `https://graph.facebook.com/v20.0/${id}/videos?access_token=${accessToken}&fields=id,permalink_url`, diff --git a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts index c9cce36f..80412537 100644 --- a/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts @@ -210,7 +210,7 @@ export class InstagramProvider const isCarousel = (firstPost?.media?.length || 0) > 1 ? `&is_carousel_item=true` : ``; const mediaType = - m.path.indexOf('.mp4') > -1 + m.url.indexOf('.mp4') > -1 ? firstPost?.media?.length === 1 ? `video_url=${m.url}&media_type=REELS` : `video_url=${m.url}&media_type=VIDEO` @@ -359,8 +359,6 @@ export class InstagramProvider ) ).json(); - console.log(all); - return ( data?.map((d: any) => ({ label: d.title, diff --git a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts index ef80d46a..8f105c18 100644 --- a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts @@ -299,13 +299,13 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider { p?.media?.flatMap(async (m) => { return { id: await this.uploadPicture( - m.path, + m.url, accessToken, id, - m.path.indexOf('mp4') > -1 - ? Buffer.from(await readOrFetch(m.path)) - : await sharp(await readOrFetch(m.path), { - animated: lookup(m.path) === 'image/gif', + m.url.indexOf('mp4') > -1 + ? Buffer.from(await readOrFetch(m.url)) + : await sharp(await readOrFetch(m.url), { + animated: lookup(m.url) === 'image/gif', }) .resize({ width: 1000, diff --git a/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts b/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts index 2d2b6155..f93668a6 100644 --- a/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts @@ -153,10 +153,10 @@ export class PinterestProvider ): Promise { let mediaId = ''; const findMp4 = postDetails?.[0]?.media?.find( - (p) => (p.path?.indexOf('mp4') || -1) > -1 + (p) => (p.url?.indexOf('mp4') || -1) > -1 ); const picture = postDetails?.[0]?.media?.find( - (p) => (p.path?.indexOf('mp4') || -1) === -1 + (p) => (p.url?.indexOf('mp4') || -1) === -1 ); if (findMp4) { diff --git a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts index 756c43b6..419a898d 100644 --- a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts @@ -113,7 +113,7 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider { `https://graph.threads.net/v1.0/${mediaContainerId}?fields=status,error_message&access_token=${accessToken}` ) ).json(); - console.log(status, error_message); + if (status === 'ERROR') { throw new Error(id); } @@ -154,18 +154,18 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider { let link = ''; if (firstPost?.media?.length! <= 1) { - const type = !firstPost?.media?.[0]?.path + const type = !firstPost?.media?.[0]?.url ? undefined - : firstPost?.media![0].path.indexOf('.mp4') > -1 + : firstPost?.media![0].url.indexOf('.mp4') > -1 ? 'video_url' : 'image_url'; const media = new URLSearchParams({ ...(type === 'video_url' - ? { video_url: firstPost?.media![0].path } + ? { video_url: firstPost?.media![0].url } : {}), ...(type === 'image_url' - ? { image_url: firstPost?.media![0].path } + ? { image_url: firstPost?.media![0].url } : {}), media_type: type === 'video_url' @@ -209,11 +209,11 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider { const medias = []; for (const mediaLoad of firstPost.media!) { const type = - mediaLoad.path.indexOf('.mp4') > -1 ? 'video_url' : 'image_url'; + mediaLoad.url.indexOf('.mp4') > -1 ? 'video_url' : 'image_url'; const media = new URLSearchParams({ - ...(type === 'video_url' ? { video_url: mediaLoad.path } : {}), - ...(type === 'image_url' ? { image_url: mediaLoad.path } : {}), + ...(type === 'video_url' ? { video_url: mediaLoad.url } : {}), + ...(type === 'image_url' ? { image_url: mediaLoad.url } : {}), is_carousel_item: 'true', media_type: type === 'video_url' diff --git a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts index e611b924..9dbccdd6 100644 --- a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts @@ -132,10 +132,10 @@ export class XProvider extends SocialAbstract implements SocialProvider { p?.media?.flatMap(async (m) => { return { id: await client.v1.uploadMedia( - m.path.indexOf('mp4') > -1 - ? Buffer.from(await readOrFetch(m.path)) - : await sharp(await readOrFetch(m.path), { - animated: lookup(m.path) === 'image/gif', + m.url.indexOf('mp4') > -1 + ? Buffer.from(await readOrFetch(m.url)) + : await sharp(await readOrFetch(m.url), { + animated: lookup(m.url) === 'image/gif', }) .resize({ width: 1000, @@ -143,7 +143,7 @@ export class XProvider extends SocialAbstract implements SocialProvider { .gif() .toBuffer(), { - mimeType: lookup(m.path) || '', + mimeType: lookup(m.url) || '', } ), postId: p.id, diff --git a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts index 019ab35d..bafa31a4 100644 --- a/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/youtube.provider.ts @@ -158,11 +158,11 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider { ...(settings?.tags?.length ? { tags: settings.tags.map((p) => p.label) } : {}), - // ...(settings?.thumbnail?.path + // ...(settings?.thumbnail?.url // ? { // thumbnails: { // default: { - // url: settings?.thumbnail?.path, + // url: settings?.thumbnail?.url, // }, // }, // } @@ -177,8 +177,6 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider { }, }); - console.log(all); - if (settings?.thumbnail?.path) { try { const allb = await youtubeClient.thumbnails.set({ @@ -194,7 +192,6 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider { }, }); - console.log(allb); } catch (err: any) { if ( err.response?.data?.error?.errors?.[0]?.domain === @@ -203,7 +200,6 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider { throw 'Your account is not verified, we have uploaded your video but we could not set the thumbnail. Please verify your account and try again.'; } - console.log(JSON.stringify(err?.response?.data, null, 2)); } } @@ -230,7 +226,6 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider { err.response?.data?.error?.errors?.[0]?.reason === 'youtubeSignupRequired' ) { - console.log('nevo david!'); throw 'You have to link your youtube account to your google account first.'; } } diff --git a/libraries/nestjs-libraries/src/openai/openai.service.ts b/libraries/nestjs-libraries/src/openai/openai.service.ts index 037a75c9..077ad9c7 100644 --- a/libraries/nestjs-libraries/src/openai/openai.service.ts +++ b/libraries/nestjs-libraries/src/openai/openai.service.ts @@ -69,7 +69,6 @@ export class OpenaiService { ']' ); } catch (e) { - console.log(content); return []; } })