Skip to content

Commit 69c70bf

Browse files
authored
Merge branch 'main' into fix/-media-minor-css-changes-and-split-media-component
2 parents 1063a80 + f8486e6 commit 69c70bf

38 files changed

+1069
-242
lines changed

.github/ISSUE_TEMPLATE/01_installation.prolem.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "🙏🏻 Installation Problem"
22
description: "Report an issue with installation"
33
title: "Installation Problem"
4-
labels: ["installation"]
4+
labels: ["type: installation"]
55
body:
66
- type: markdown
77
attributes:
@@ -13,4 +13,7 @@ body:
1313
attributes:
1414
label: For installation issues, please visit our https://discord.postiz.com for assistance.
1515
description: For installation issues, please visit our [Discord Support](https://discord.postiz.com) for assistance.
16-
placeholder: For installation issues, please visit our https://discord.postiz.com for assistance.
16+
placeholder: |
17+
For installation issues, please visit our https://discord.postiz.com for assistance.
18+
Please do not save this issue - do not submit installation issues on GitHub.
19+

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
2-
Please help us out on Product Hunt,<br />to give you the best open-source<br />social media scheduling tool in the world 🌎👇 <br /><br />
3-
<a href="https://www.producthunt.com/posts/postiz?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-postiz" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=606350&theme=light" alt="Postiz - Your&#0032;ultimate&#0032;AI&#0032;social&#0032;media&#0032;scheduling&#0032;tool&#0032; | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
4-
<br /><br />
2+
<a href="https://affiliate.postiz.com">
3+
<img src="https://github.com/user-attachments/assets/af9f47b3-e20c-402b-bd11-02f39248d738" />
4+
</a>
55
</p>
66

77
<p align="center">

apps/backend/src/api/routes/integrations.controller.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Get,
66
Param,
77
Post,
8+
Put,
89
Query,
910
UseFilters,
1011
} from '@nestjs/common';
@@ -48,6 +49,37 @@ export class IntegrationsController {
4849
return this._integrationManager.getAllIntegrations();
4950
}
5051

52+
@Get('/customers')
53+
getCustomers(@GetOrgFromRequest() org: Organization) {
54+
return this._integrationService.customers(org.id);
55+
}
56+
57+
@Put('/:id/group')
58+
async updateIntegrationGroup(
59+
@GetOrgFromRequest() org: Organization,
60+
@Param('id') id: string,
61+
@Body() body: { group: string }
62+
) {
63+
return this._integrationService.updateIntegrationGroup(
64+
org.id,
65+
id,
66+
body.group
67+
);
68+
}
69+
70+
@Put('/:id/customer-name')
71+
async updateOnCustomerName(
72+
@GetOrgFromRequest() org: Organization,
73+
@Param('id') id: string,
74+
@Body() body: { name: string }
75+
) {
76+
return this._integrationService.updateOnCustomerName(
77+
org.id,
78+
id,
79+
body.name
80+
);
81+
}
82+
5183
@Get('/list')
5284
async getIntegrationList(@GetOrgFromRequest() org: Organization) {
5385
return {
@@ -71,6 +103,7 @@ export class IntegrationsController {
71103
time: JSON.parse(p.postingTimes),
72104
changeProfilePicture: !!findIntegration?.changeProfilePicture,
73105
changeNickName: !!findIntegration?.changeNickname,
106+
customer: p.customer,
74107
};
75108
}),
76109
};
@@ -408,9 +441,17 @@ export class IntegrationsController {
408441
);
409442
}
410443

444+
let validName = name;
445+
if (!validName) {
446+
if (username) {
447+
validName = username.split('.')[0] ?? username;
448+
} else {
449+
validName = `Channel_${String(id).slice(0, 8)}`;
450+
}
451+
}
411452
return this._integrationService.createOrUpdateIntegration(
412453
org.id,
413-
name,
454+
validName.trim(),
414455
picture,
415456
'social',
416457
String(id),

apps/frontend/public/favicon.ico

100644100755
320 Bytes
Binary file not shown.

apps/frontend/src/app/global.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,3 +384,14 @@ div div .set-font-family {
384384
font-style: normal !important;
385385
font-weight: 400 !important;
386386
}
387+
388+
.col-calendar:hover:before {
389+
content: "Date passed";
390+
color: white;
391+
position: absolute;
392+
left: 50%;
393+
top: 50%;
394+
transform: translate(-50%, -50%);
395+
white-space: nowrap;
396+
opacity: 30%;
397+
}

apps/frontend/src/app/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { VariableContextComponent } from '@gitroom/react/helpers/variable.contex
1313
import { Fragment } from 'react';
1414
import { PHProvider } from '@gitroom/react/helpers/posthog';
1515
import UtmSaver from '@gitroom/helpers/utils/utm.saver';
16+
import { ToltScript } from '@gitroom/frontend/components/layout/tolt.script';
1617

1718
const chakra = Chakra_Petch({ weight: '400', subsets: ['latin'] });
1819

@@ -26,7 +27,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
2627
<head>
2728
<link
2829
rel="icon"
29-
href={!!process.env.IS_GENERAL ? '/favicon.png' : '/postiz-fav.png'}
30+
href="/favicon.ico"
3031
sizes="any"
3132
/>
3233
</head>
@@ -42,7 +43,9 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
4243
frontEndUrl={process.env.FRONTEND_URL!}
4344
isGeneral={!!process.env.IS_GENERAL}
4445
uploadDirectory={process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY!}
46+
tolt={process.env.NEXT_PUBLIC_TOLT!}
4547
>
48+
<ToltScript />
4649
<Plausible
4750
domain={!!process.env.IS_GENERAL ? 'postiz.com' : 'gitroom.com'}
4851
>

apps/frontend/src/components/billing/main.billing.component.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.titl
2323
import { Textarea } from '@gitroom/react/form/textarea';
2424
import { useFireEvents } from '@gitroom/helpers/utils/use.fire.events';
2525
import { useUtmUrl } from '@gitroom/helpers/utils/utm.saver';
26+
import { useTolt } from '@gitroom/frontend/components/layout/tolt.script';
2627

2728
export interface Tiers {
2829
month: Array<{
@@ -221,6 +222,7 @@ export const MainBillingComponent: FC<{
221222
const modal = useModals();
222223
const router = useRouter();
223224
const utm = useUtmUrl();
225+
const tolt = useTolt();
224226

225227
const [subscription, setSubscription] = useState<Subscription | undefined>(
226228
sub
@@ -348,6 +350,7 @@ export const MainBillingComponent: FC<{
348350
period: monthlyOrYearly === 'on' ? 'YEARLY' : 'MONTHLY',
349351
utm,
350352
billing,
353+
tolt: tolt()
351354
}),
352355
})
353356
).json();

apps/frontend/src/components/launches/add.edit.model.tsx

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
5050
import Image from 'next/image';
5151
import { weightedLength } from '@gitroom/helpers/utils/count.length';
5252
import { MultiMediaComponent } from '../media/multimedia.component';
53+
import { uniqBy } from 'lodash';
54+
import { Select } from '@gitroom/react/form/select';
5355

5456
function countCharacters(text: string, type: string): number {
5557
if (type !== 'x') {
@@ -65,17 +67,36 @@ export const AddEditModal: FC<{
6567
reopenModal: () => void;
6668
mutate: () => void;
6769
}> = (props) => {
68-
const { date, integrations, reopenModal, mutate } = props;
69-
const [dateState, setDateState] = useState(date);
70-
71-
// hook to open a new modal
72-
const modal = useModals();
70+
const { date, integrations: ints, reopenModal, mutate } = props;
71+
const [customer, setCustomer] = useState('');
7372

7473
// selected integrations to allow edit
7574
const [selectedIntegrations, setSelectedIntegrations] = useStateCallback<
7675
Integrations[]
7776
>([]);
7877

78+
const integrations = useMemo(() => {
79+
if (!customer) {
80+
return ints;
81+
}
82+
83+
const list = ints.filter((f) => f?.customer?.id === customer);
84+
if (list.length === 1) {
85+
setSelectedIntegrations([list[0]]);
86+
}
87+
88+
return list;
89+
}, [customer, ints]);
90+
91+
const totalCustomers = useMemo(() => {
92+
return uniqBy(ints, (i) => i?.customer?.id).length;
93+
}, [ints]);
94+
95+
const [dateState, setDateState] = useState(date);
96+
97+
// hook to open a new modal
98+
const modal = useModals();
99+
79100
// value of each editor
80101
const [value, setValue] = useState<
81102
Array<{
@@ -276,7 +297,8 @@ export const AddEditModal: FC<{
276297
for (const key of allKeys) {
277298
if (key.checkValidity) {
278299
const check = await key.checkValidity(
279-
key?.value.map((p: any) => p.image || [])
300+
key?.value.map((p: any) => p.image || []),
301+
key.settings
280302
);
281303
if (typeof check === 'string') {
282304
toaster.show(check, 'warning');
@@ -285,11 +307,12 @@ export const AddEditModal: FC<{
285307
}
286308

287309
if (
288-
key.value.some(
289-
(p) => {
290-
return countCharacters(p.content, key?.integration?.identifier || '') > (key.maximumCharacters || 1000000);
291-
}
292-
)
310+
key.value.some((p) => {
311+
return (
312+
countCharacters(p.content, key?.integration?.identifier || '') >
313+
(key.maximumCharacters || 1000000)
314+
);
315+
})
293316
) {
294317
if (
295318
!(await deleteDialog(
@@ -416,6 +439,26 @@ export const AddEditModal: FC<{
416439
information={data}
417440
onChange={setPostFor}
418441
/>
442+
{totalCustomers > 1 && (
443+
<Select
444+
hideErrors={true}
445+
label=""
446+
name="customer"
447+
value={customer}
448+
onChange={(e) => {
449+
setCustomer(e.target.value);
450+
setSelectedIntegrations([]);
451+
}}
452+
disableForm={true}
453+
>
454+
<option value="">Selected Customer</option>
455+
{uniqBy(ints, (u) => u?.customer?.name).map((p) => (
456+
<option key={p.customer?.id} value={p.customer?.id}>
457+
Customer: {p.customer?.name}
458+
</option>
459+
))}
460+
</Select>
461+
)}
419462
<DatePicker onChange={setDateState} date={dateState} />
420463
</div>
421464
</TopTitle>

apps/frontend/src/components/launches/calendar.context.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export interface Integrations {
6262
changeProfilePicture: boolean;
6363
changeNickName: boolean;
6464
time: { time: number }[];
65+
customer?: {
66+
name?: string;
67+
id?: string;
68+
}
6569
}
6670

6771
function getWeekNumber(date: Date) {

apps/frontend/src/components/launches/calendar.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import clsx from 'clsx';
1313
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
1414
import { ExistingDataContextProvider } from '@gitroom/frontend/components/launches/helpers/use.existing.data';
1515
import { useDrag, useDrop } from 'react-dnd';
16-
import { DNDProvider } from '@gitroom/frontend/components/launches/helpers/dnd.provider';
1716
import { Integration, Post, State } from '@prisma/client';
1817
import { useAddProvider } from '@gitroom/frontend/components/launches/add.provider.component';
1918
import { CommentComponent } from '@gitroom/frontend/components/launches/comments/comment.component';
@@ -27,9 +26,19 @@ import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
2726
import { groupBy, sortBy } from 'lodash';
2827
import Image from 'next/image';
2928
import { extend } from 'dayjs';
29+
import { isUSCitizen } from './helpers/isuscitizen.utils';
30+
import removeMd from 'remove-markdown';
3031
extend(isSameOrAfter);
3132
extend(isSameOrBefore);
3233

34+
const convertTimeFormatBasedOnLocality = (time: number) => {
35+
if (isUSCitizen()) {
36+
return `${time === 12 ? 12 : time % 12}:00 ${time >= 12 ? 'PM' : 'AM'}`;
37+
} else {
38+
return `${time}:00`;
39+
}
40+
};
41+
3342
export const days = [
3443
'Monday',
3544
'Tuesday',
@@ -91,7 +100,7 @@ export const DayView = () => {
91100
.startOf('day')
92101
.add(option[0].time, 'minute')
93102
.local()
94-
.format('HH:mm')}
103+
.format(isUSCitizen() ? 'hh:mm A' : 'HH:mm')}
95104
</div>
96105
<div
97106
key={option[0].time}
@@ -140,7 +149,8 @@ export const WeekView = () => {
140149
{hours.map((hour) => (
141150
<Fragment key={hour}>
142151
<div className="p-2 pr-4 bg-secondary text-center items-center justify-center flex">
143-
{hour.toString().padStart(2, '0')}:00
152+
{/* {hour.toString().padStart(2, '0')}:00 */}
153+
{convertTimeFormatBasedOnLocality(hour)}
144154
</div>
145155
{days.map((day, indexDay) => (
146156
<Fragment key={`${day}-${hour}`}>
@@ -231,15 +241,15 @@ export const Calendar = () => {
231241
const { display } = useCalendar();
232242

233243
return (
234-
<DNDProvider>
244+
<>
235245
{display === 'day' ? (
236246
<DayView />
237247
) : display === 'week' ? (
238248
<WeekView />
239249
) : (
240250
<MonthView />
241251
)}
242-
</DNDProvider>
252+
</>
243253
);
244254
};
245255

@@ -433,8 +443,9 @@ export const CalendarColumn: FC<{
433443
)}
434444
<div
435445
className={clsx(
436-
'relative flex flex-col flex-1',
437-
canDrop && 'bg-white/80'
446+
'relative flex flex-col flex-1 text-white',
447+
canDrop && 'bg-white/80',
448+
isBeforeNow && postList.length === 0 && 'cursor-not-allowed'
438449
)}
439450
>
440451
<div
@@ -445,8 +456,9 @@ export const CalendarColumn: FC<{
445456
}
446457
: {})}
447458
className={clsx(
448-
'flex-col text-[12px] pointer w-full cursor-pointer overflow-hidden overflow-x-auto flex scrollbar scrollbar-thumb-tableBorder scrollbar-track-secondary',
449-
isBeforeNow && 'bg-customColor23 flex-1',
459+
'flex-col text-[12px] pointer w-full overflow-hidden overflow-x-auto flex scrollbar scrollbar-thumb-tableBorder scrollbar-track-secondary',
460+
isBeforeNow ? 'bg-customColor23 flex-1' : 'cursor-pointer',
461+
isBeforeNow && postList.length === 0 && 'col-calendar',
450462
canBeTrending && 'bg-customColor24'
451463
)}
452464
>
@@ -593,7 +605,7 @@ const CalendarItem: FC<{
593605
</div>
594606
<div className="whitespace-pre-wrap line-clamp-3">
595607
{state === 'DRAFT' ? 'Draft: ' : ''}
596-
{post.content}
608+
{removeMd(post.content).replace(/\n/g, ' ')}
597609
</div>
598610
</div>
599611
);

0 commit comments

Comments
 (0)