+
{error}
diff --git a/apps/frontend/src/components/media/new.uploader.tsx b/apps/frontend/src/components/media/new.uploader.tsx
index 93038db3..6260f695 100644
--- a/apps/frontend/src/components/media/new.uploader.tsx
+++ b/apps/frontend/src/components/media/new.uploader.tsx
@@ -54,6 +54,7 @@ export function MultipartFileUploader({
/>
);
}
+
export function useUppyUploader(props: {
// @ts-ignore
onUploadSuccess: (result: UploadResult) => void;
@@ -120,67 +121,6 @@ export function useUppyUploader(props: {
});
});
- // required thumbnails
- uppy2.addPreProcessor(async (fileIDs) => {
- return new Promise
(async (resolve, reject) => {
- const findVideos = uppy2
- .getFiles()
- .filter((f) => fileIDs.includes(f.id))
- .filter((f) => f.type?.startsWith('video/'));
-
- if (findVideos.length === 0) {
- resolve(true);
- return;
- }
-
- for (const currentVideo of findVideos) {
- const resolvedVideo = await new Promise((resolve, reject) => {
- const video = document.createElement('video');
- const url = URL.createObjectURL(currentVideo.data);
- const canvas = document.createElement('canvas');
- const ctx = canvas.getContext('2d');
-
- video.addEventListener('loadedmetadata', () => {
- const duration = video.duration;
- const randomTime = Math.random() * duration;
-
- video.currentTime = randomTime;
-
- video.addEventListener('seeked', function capture() {
- canvas.width = video.videoWidth;
- canvas.height = video.videoHeight;
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
-
- canvas.toBlob((blob) => {
- resolve(blob);
- });
- // Cleanup
- video.removeEventListener('seeked', capture);
- URL.revokeObjectURL(url);
- });
- });
-
- video.src = url;
- });
-
- uppy2.addFile({
- name: `thumbnail-${Date.now()}.jpg`,
- type: 'image/jpeg',
- data: resolvedVideo,
- meta: {
- thumbnail: true,
- videoId: currentVideo.id,
- },
- isRemote: false,
- });
- }
-
- // add the new thumbnail to uppy seperate from the file
-
- resolve(true);
- });
- });
-
const { plugin, options } = getUppyUploadPlugin(
transloadit.length > 0 ? 'transloadit' : storageProvider,
fetch,
diff --git a/apps/frontend/src/components/new-launch/editor.tsx b/apps/frontend/src/components/new-launch/editor.tsx
index ef4a81fa..de833050 100644
--- a/apps/frontend/src/components/new-launch/editor.tsx
+++ b/apps/frontend/src/components/new-launch/editor.tsx
@@ -28,15 +28,10 @@ import { UpDownArrow } from '@gitroom/frontend/components/launches/up.down.arrow
import { deleteDialog } from '@gitroom/react/helpers/delete.dialog';
import { useExistingData } from '@gitroom/frontend/components/launches/helpers/use.existing.data';
import { useCopilotAction, useCopilotReadable } from '@copilotkit/react-core';
-import {
- LinkedinCompany,
- LinkedinCompanyPop,
- ShowLinkedinCompany,
-} from '@gitroom/frontend/components/launches/helpers/linkedin.component';
-import { DropEvent, FileRejection, useDropzone } from 'react-dropzone';
+import { LinkedinCompanyPop } from '@gitroom/frontend/components/launches/helpers/linkedin.component';
+import { useDropzone } from 'react-dropzone';
import { useUppyUploader } from '@gitroom/frontend/components/media/new.uploader';
-import { UploadResult } from '@uppy/core';
-import { Dashboard, ProgressBar } from '@uppy/react';
+import { Dashboard } from '@uppy/react';
export const EditorWrapper: FC<{
totalPosts: number;
value: string;
@@ -261,102 +256,108 @@ export const EditorWrapper: FC<{
return null;
}
- return items.map((g, index) => (
-
- {!canEdit && !isCreateSet && (
-
{
- if (index !== 0) {
- return;
- }
+ return (
+
+ {items.map((g, index) => (
+
+ {!canEdit && !isCreateSet && (
+
{
+ if (index !== 0) {
+ return;
+ }
- setLoaded(false);
- addRemoveInternal(current);
- }}
- className="select-none cursor-pointer absolute w-full h-full left-0 top-0 bg-red-600/10 z-[100]"
- >
- {index === 0 && (
-
- Edit
+ setLoaded(false);
+ addRemoveInternal(current);
+ }}
+ className="select-none cursor-pointer absolute w-full h-full left-0 top-0 bg-red-600/10 z-[100]"
+ >
+ {index === 0 && (
+
+ Edit
+
+ )}
)}
-
- )}
-
-
-
-
-
-
- {index === 0 &&
- current !== 'global' &&
- canEdit &&
- !existingData.integration && (
-
- )}
- {items.length > 1 && (
-
+
+ {canEdit ? (
+
+ ) : (
+
)}
-
-
- {canEdit ? (
-
- ) :
}
+ ))}
- ));
+ );
};
export const Editor: FC<{
@@ -475,6 +476,14 @@ export const Editor: FC<{
+ {validateChars && props.value.length < 6 && (
+
+ {t(
+ 'the_post_should_be_at_least_6_characters_long',
+ 'The post should be at least 6 characters long'
+ )}
+
+ )}
- {validateChars && props.value.length < 6 && (
-
- {t(
- 'the_post_should_be_at_least_6_characters_long',
- 'The post should be at least 6 characters long'
- )}
-
- )}
+
{setImages && (