feat: many fixes
This commit is contained in:
parent
6853c5b1e1
commit
ef885eaa45
|
|
@ -73,7 +73,7 @@ export const DatePicker: FC<{
|
|||
}
|
||||
|
||||
if (modifiers.selected) {
|
||||
return '!text-textColor !bg-seventh !outline-none';
|
||||
return '!text-white !bg-seventh !outline-none';
|
||||
}
|
||||
|
||||
return '!text-textColor';
|
||||
|
|
@ -95,7 +95,7 @@ export const DatePicker: FC<{
|
|||
defaultValue={date.toDate()}
|
||||
/>
|
||||
<Button className="mt-[12px]" onClick={changeShow}>
|
||||
Close
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ export const withProvider = function <T extends object>(
|
|||
<EditorWrapper>
|
||||
<div className="flex flex-col gap-[20px]">
|
||||
{!existingData?.integration && (
|
||||
<div className="bg-red-800">
|
||||
<div className="bg-red-800 text-white">
|
||||
You are now editing only {integration?.name} (
|
||||
{capitalize(integration?.identifier.replace('-', ' '))})
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|||
import Uppy, { UploadResult } from '@uppy/core';
|
||||
// @ts-ignore
|
||||
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
|
||||
import { getUppyUploadPlugin } from '@gitroom/react/helpers/uppy.upload';
|
||||
import { getUppyUploadPlugin } from '@gitroom/react/helpers/uppy.upload';
|
||||
import { FileInput, ProgressBar } from '@uppy/react';
|
||||
|
||||
// Uppy styles
|
||||
import '@uppy/core/dist/style.min.css';
|
||||
import '@uppy/dashboard/dist/style.min.css';
|
||||
import { useVariables } from '@gitroom/react/helpers/variable.context';
|
||||
import Compressor from '@uppy/compressor';
|
||||
|
||||
export function MultipartFileUploader({
|
||||
onUploadSuccess,
|
||||
|
|
@ -22,10 +23,13 @@ export function MultipartFileUploader({
|
|||
const [loaded, setLoaded] = useState(false);
|
||||
const [reload, setReload] = useState(false);
|
||||
|
||||
const onUploadSuccessExtended = useCallback((result: UploadResult<any,any>) => {
|
||||
setReload(true);
|
||||
onUploadSuccess(result);
|
||||
}, [onUploadSuccess]);
|
||||
const onUploadSuccessExtended = useCallback(
|
||||
(result: UploadResult<any, any>) => {
|
||||
setReload(true);
|
||||
onUploadSuccess(result);
|
||||
},
|
||||
[onUploadSuccess]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (reload) {
|
||||
|
|
@ -59,9 +63,9 @@ export function MultipartFileUploaderAfter({
|
|||
onUploadSuccess: (result: UploadResult) => void;
|
||||
allowedFileTypes: string;
|
||||
}) {
|
||||
const {storageProvider, backendUrl} = useVariables();
|
||||
const { storageProvider, backendUrl } = useVariables();
|
||||
const fetch = useFetch();
|
||||
|
||||
|
||||
const uppy = useMemo(() => {
|
||||
const uppy2 = new Uppy({
|
||||
autoProceed: true,
|
||||
|
|
@ -71,16 +75,25 @@ export function MultipartFileUploaderAfter({
|
|||
maxFileSize: 1000000000,
|
||||
},
|
||||
});
|
||||
|
||||
const { plugin, options } = getUppyUploadPlugin(storageProvider, fetch, backendUrl)
|
||||
uppy2.use(plugin, options)
|
||||
|
||||
const { plugin, options } = getUppyUploadPlugin(
|
||||
storageProvider,
|
||||
fetch,
|
||||
backendUrl
|
||||
);
|
||||
uppy2.use(plugin, options);
|
||||
uppy2.use(Compressor, {
|
||||
convertTypes: ['image/jpeg'],
|
||||
maxWidth: 1000,
|
||||
maxHeight: 1000,
|
||||
});
|
||||
// Set additional metadata when a file is added
|
||||
uppy2.on('file-added', (file) => {
|
||||
uppy2.setFileMeta(file.id, {
|
||||
useCloudflare: storageProvider === 'cloudflare' ? 'true' : 'false', // Example of adding a custom field
|
||||
// Add more fields as needed
|
||||
});
|
||||
uppy2.setFileMeta(file.id, {
|
||||
useCloudflare: storageProvider === 'cloudflare' ? 'true' : 'false', // Example of adding a custom field
|
||||
// Add more fields as needed
|
||||
});
|
||||
});
|
||||
|
||||
uppy2.on('complete', (result) => {
|
||||
onUploadSuccess(result);
|
||||
|
|
@ -111,9 +124,9 @@ export function MultipartFileUploaderAfter({
|
|||
strings: {
|
||||
chooseFiles: 'Upload',
|
||||
},
|
||||
pluralize: (n) => n
|
||||
pluralize: (n) => n,
|
||||
}}
|
||||
/>
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,13 +189,14 @@ export class PostsRepository {
|
|||
});
|
||||
}
|
||||
|
||||
changeState(id: string, state: State) {
|
||||
changeState(id: string, state: State, err?: string) {
|
||||
return this._post.model.post.update({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
data: {
|
||||
state,
|
||||
error: typeof err === 'string' ? err : JSON.stringify(err),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export class PostsService {
|
|||
});
|
||||
}
|
||||
} catch (err: any) {
|
||||
await this._postRepository.changeState(firstPost.id, 'ERROR');
|
||||
await this._postRepository.changeState(firstPost.id, 'ERROR', err);
|
||||
await this._notificationService.inAppNotification(
|
||||
firstPost.organizationId,
|
||||
`Error posting on ${firstPost.integration?.providerIdentifier} for ${firstPost?.integration?.name}`,
|
||||
|
|
|
|||
|
|
@ -342,6 +342,7 @@ model Post {
|
|||
lastMessageId String?
|
||||
lastMessage Messages? @relation(fields: [lastMessageId], references: [id])
|
||||
payoutProblems PayoutProblems[]
|
||||
error String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ export abstract class SocialAbstract {
|
|||
|
||||
if (
|
||||
request.status === 401 ||
|
||||
(json.includes('OAuthException') && !json.includes("Unsupported format") && !json.includes('2207018') && !json.includes('REVOKED_ACCESS_TOKEN'))
|
||||
(json.includes('OAuthException') &&
|
||||
!json.includes('The user is not an Instagram Business') &&
|
||||
!json.includes('Unsupported format') &&
|
||||
!json.includes('2207018') &&
|
||||
!json.includes('REVOKED_ACCESS_TOKEN'))
|
||||
) {
|
||||
throw new RefreshToken(identifier, json, options.body!);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import {
|
|||
SocialProvider,
|
||||
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
|
||||
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
|
||||
import { NotEnoughScopes, SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
|
||||
import {
|
||||
NotEnoughScopes,
|
||||
SocialAbstract,
|
||||
} from '@gitroom/nestjs-libraries/integrations/social.abstract';
|
||||
import { BskyAgent, RichText } from '@atproto/api';
|
||||
import dayjs from 'dayjs';
|
||||
import { Integration } from '@prisma/client';
|
||||
|
|
@ -126,14 +129,8 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
|
|||
for (const post of postDetails) {
|
||||
const images = await Promise.all(
|
||||
post.media?.map(async (p) => {
|
||||
const a = await fetch(p.url);
|
||||
console.log(p.url);
|
||||
return await agent.uploadBlob(
|
||||
new Blob([
|
||||
await sharp(await (await fetch(p.url)).arrayBuffer())
|
||||
.resize({ width: 400 })
|
||||
.toBuffer(),
|
||||
])
|
||||
new Blob([await (await fetch(p.url)).arrayBuffer()])
|
||||
);
|
||||
}) || []
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
|
||||
import dayjs from 'dayjs';
|
||||
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
|
||||
import { string } from 'yup';
|
||||
|
||||
export class FacebookProvider extends SocialAbstract implements SocialProvider {
|
||||
identifier = 'facebook';
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -88,6 +88,7 @@
|
|||
"@uidotdev/usehooks": "^2.4.1",
|
||||
"@uiw/react-md-editor": "^4.0.3",
|
||||
"@uppy/aws-s3": "^4.1.0",
|
||||
"@uppy/compressor": "^2.1.1",
|
||||
"@uppy/core": "^4.2.0",
|
||||
"@uppy/dashboard": "^4.1.0",
|
||||
"@uppy/drag-drop": "^4.0.2",
|
||||
|
|
|
|||
Loading…
Reference in New Issue