diff --git a/apps/frontend/src/components/launches/general.preview.component.tsx b/apps/frontend/src/components/launches/general.preview.component.tsx new file mode 100644 index 00000000..a6d98d55 --- /dev/null +++ b/apps/frontend/src/components/launches/general.preview.component.tsx @@ -0,0 +1,90 @@ +import { useIntegration } from '@gitroom/frontend/components/launches/helpers/use.integration'; +import { useMediaDirectory } from '@gitroom/react/helpers/use.media.directory'; +import { useFormatting } from '@gitroom/frontend/components/launches/helpers/use.formatting'; +import clsx from 'clsx'; +import { VideoOrImage } from '@gitroom/react/helpers/video.or.image'; +import { Chakra_Petch } from 'next/font/google'; +const chakra = Chakra_Petch({ weight: '400', subsets: ['latin'] }); + +export const GeneralPreviewComponent = () => { + 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 && ( +
3 ? 'grid grid-cols-2 gap-[4px]' : 'flex gap-[4px]')}> + {value.images.map((image, index) => ( + + + + ))} +
+ )} +
+
+ ))} +
+
+ ); +}; 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 5da567ab..4971260a 100644 --- a/apps/frontend/src/components/launches/providers/high.order.provider.tsx +++ b/apps/frontend/src/components/launches/providers/high.order.provider.tsx @@ -32,6 +32,8 @@ import { linkedinCompany } from '@gitroom/frontend/components/launches/helpers/l import { Editor } from '@gitroom/frontend/components/launches/editor'; import { useCopilotAction, useCopilotReadable } from '@copilotkit/react-core'; import { AddPostButton } from '@gitroom/frontend/components/launches/add.post.button'; +import { GeneralPreviewComponent } from '@gitroom/frontend/components/launches/general.preview.component'; +import { capitalize } from 'lodash'; // Simple component to change back to settings on after changing tab export const SetTab: FC<{ changeTab: () => void }> = (props) => { @@ -277,7 +279,7 @@ export const withProvider = ( secondary={showTab !== 1} onClick={changeToEditor} > - {editInPlace ? 'Edit globally' : 'Edit only this'} + {editInPlace ? 'Edit globally' : `Edit only ${integration?.name} (${capitalize(integration?.identifier.replace('-', ' '))})`}
@@ -288,7 +290,7 @@ export const withProvider = (
{!existingData?.integration && (
- This will edit only this provider + You are now editing only {integration?.name} ({capitalize(integration?.identifier.replace('-', ' '))})
)} {InPlaceValue.map((val, index) => ( @@ -304,7 +306,7 @@ export const withProvider = ( // ...commands // .getCommands() // .filter((f) => f.name !== 'image'), - newImage, + // newImage, postSelector(date), ...linkedinCompany( integration?.identifier!, @@ -396,7 +398,7 @@ export const withProvider = ( {(editInPlace ? InPlaceValue : props.value) .map((p) => p.content) .join('').length ? ( - + ) : ( <>No Content Yet )}