Skip to content

Commit ef885ea

Browse files
committed
feat: many fixes
1 parent 6853c5b commit ef885ea

File tree

11 files changed

+323
-772
lines changed

11 files changed

+323
-772
lines changed

apps/frontend/src/components/launches/helpers/date.picker.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const DatePicker: FC<{
7373
}
7474

7575
if (modifiers.selected) {
76-
return '!text-textColor !bg-seventh !outline-none';
76+
return '!text-white !bg-seventh !outline-none';
7777
}
7878

7979
return '!text-textColor';
@@ -95,7 +95,7 @@ export const DatePicker: FC<{
9595
defaultValue={date.toDate()}
9696
/>
9797
<Button className="mt-[12px]" onClick={changeShow}>
98-
Close
98+
Save
9999
</Button>
100100
</div>
101101
)}

apps/frontend/src/components/launches/providers/high.order.provider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export const withProvider = function <T extends object>(
331331
<EditorWrapper>
332332
<div className="flex flex-col gap-[20px]">
333333
{!existingData?.integration && (
334-
<div className="bg-red-800">
334+
<div className="bg-red-800 text-white">
335335
You are now editing only {integration?.name} (
336336
{capitalize(integration?.identifier.replace('-', ' '))})
337337
</div>

apps/frontend/src/components/media/new.uploader.tsx

+29-16
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
33
import Uppy, { UploadResult } from '@uppy/core';
44
// @ts-ignore
55
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
6-
import { getUppyUploadPlugin } from '@gitroom/react/helpers/uppy.upload';
6+
import { getUppyUploadPlugin } from '@gitroom/react/helpers/uppy.upload';
77
import { FileInput, ProgressBar } from '@uppy/react';
88

99
// Uppy styles
1010
import '@uppy/core/dist/style.min.css';
1111
import '@uppy/dashboard/dist/style.min.css';
1212
import { useVariables } from '@gitroom/react/helpers/variable.context';
13+
import Compressor from '@uppy/compressor';
1314

1415
export function MultipartFileUploader({
1516
onUploadSuccess,
@@ -22,10 +23,13 @@ export function MultipartFileUploader({
2223
const [loaded, setLoaded] = useState(false);
2324
const [reload, setReload] = useState(false);
2425

25-
const onUploadSuccessExtended = useCallback((result: UploadResult<any,any>) => {
26-
setReload(true);
27-
onUploadSuccess(result);
28-
}, [onUploadSuccess]);
26+
const onUploadSuccessExtended = useCallback(
27+
(result: UploadResult<any, any>) => {
28+
setReload(true);
29+
onUploadSuccess(result);
30+
},
31+
[onUploadSuccess]
32+
);
2933

3034
useEffect(() => {
3135
if (reload) {
@@ -59,9 +63,9 @@ export function MultipartFileUploaderAfter({
5963
onUploadSuccess: (result: UploadResult) => void;
6064
allowedFileTypes: string;
6165
}) {
62-
const {storageProvider, backendUrl} = useVariables();
66+
const { storageProvider, backendUrl } = useVariables();
6367
const fetch = useFetch();
64-
68+
6569
const uppy = useMemo(() => {
6670
const uppy2 = new Uppy({
6771
autoProceed: true,
@@ -71,16 +75,25 @@ export function MultipartFileUploaderAfter({
7175
maxFileSize: 1000000000,
7276
},
7377
});
74-
75-
const { plugin, options } = getUppyUploadPlugin(storageProvider, fetch, backendUrl)
76-
uppy2.use(plugin, options)
78+
79+
const { plugin, options } = getUppyUploadPlugin(
80+
storageProvider,
81+
fetch,
82+
backendUrl
83+
);
84+
uppy2.use(plugin, options);
85+
uppy2.use(Compressor, {
86+
convertTypes: ['image/jpeg'],
87+
maxWidth: 1000,
88+
maxHeight: 1000,
89+
});
7790
// Set additional metadata when a file is added
7891
uppy2.on('file-added', (file) => {
79-
uppy2.setFileMeta(file.id, {
80-
useCloudflare: storageProvider === 'cloudflare' ? 'true' : 'false', // Example of adding a custom field
81-
// Add more fields as needed
82-
});
92+
uppy2.setFileMeta(file.id, {
93+
useCloudflare: storageProvider === 'cloudflare' ? 'true' : 'false', // Example of adding a custom field
94+
// Add more fields as needed
8395
});
96+
});
8497

8598
uppy2.on('complete', (result) => {
8699
onUploadSuccess(result);
@@ -111,9 +124,9 @@ export function MultipartFileUploaderAfter({
111124
strings: {
112125
chooseFiles: 'Upload',
113126
},
114-
pluralize: (n) => n
127+
pluralize: (n) => n,
115128
}}
116-
/>
129+
/>
117130
</>
118131
);
119132
}

libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,14 @@ export class PostsRepository {
189189
});
190190
}
191191

192-
changeState(id: string, state: State) {
192+
changeState(id: string, state: State, err?: string) {
193193
return this._post.model.post.update({
194194
where: {
195195
id,
196196
},
197197
data: {
198198
state,
199+
error: typeof err === 'string' ? err : JSON.stringify(err),
199200
},
200201
});
201202
}

libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class PostsService {
146146
});
147147
}
148148
} catch (err: any) {
149-
await this._postRepository.changeState(firstPost.id, 'ERROR');
149+
await this._postRepository.changeState(firstPost.id, 'ERROR', err);
150150
await this._notificationService.inAppNotification(
151151
firstPost.organizationId,
152152
`Error posting on ${firstPost.integration?.providerIdentifier} for ${firstPost?.integration?.name}`,

libraries/nestjs-libraries/src/database/prisma/schema.prisma

+1
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ model Post {
342342
lastMessageId String?
343343
lastMessage Messages? @relation(fields: [lastMessageId], references: [id])
344344
payoutProblems PayoutProblems[]
345+
error String?
345346
createdAt DateTime @default(now())
346347
updatedAt DateTime @updatedAt
347348
deletedAt DateTime?

libraries/nestjs-libraries/src/integrations/social.abstract.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ export abstract class SocialAbstract {
4646

4747
if (
4848
request.status === 401 ||
49-
(json.includes('OAuthException') && !json.includes("Unsupported format") && !json.includes('2207018') && !json.includes('REVOKED_ACCESS_TOKEN'))
49+
(json.includes('OAuthException') &&
50+
!json.includes('The user is not an Instagram Business') &&
51+
!json.includes('Unsupported format') &&
52+
!json.includes('2207018') &&
53+
!json.includes('REVOKED_ACCESS_TOKEN'))
5054
) {
5155
throw new RefreshToken(identifier, json, options.body!);
5256
}

libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
SocialProvider,
66
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
77
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
8-
import { NotEnoughScopes, SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
8+
import {
9+
NotEnoughScopes,
10+
SocialAbstract,
11+
} from '@gitroom/nestjs-libraries/integrations/social.abstract';
912
import { BskyAgent, RichText } from '@atproto/api';
1013
import dayjs from 'dayjs';
1114
import { Integration } from '@prisma/client';
@@ -126,14 +129,8 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
126129
for (const post of postDetails) {
127130
const images = await Promise.all(
128131
post.media?.map(async (p) => {
129-
const a = await fetch(p.url);
130-
console.log(p.url);
131132
return await agent.uploadBlob(
132-
new Blob([
133-
await sharp(await (await fetch(p.url)).arrayBuffer())
134-
.resize({ width: 400 })
135-
.toBuffer(),
136-
])
133+
new Blob([await (await fetch(p.url)).arrayBuffer()])
137134
);
138135
}) || []
139136
);

libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
99
import dayjs from 'dayjs';
1010
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
11-
import { string } from 'yup';
1211

1312
export class FacebookProvider extends SocialAbstract implements SocialProvider {
1413
identifier = 'facebook';

0 commit comments

Comments
 (0)