@canva/cli 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +1 -0
- package/cli.js +353 -353
- package/package.json +2 -2
- package/templates/base/backend/base_backend/create.ts +10 -0
- package/templates/base/backend/routers/auth.ts +12 -9
- package/templates/base/package.json +4 -4
- package/templates/base/tsconfig.json +0 -1
- package/templates/base/webpack.config.ts +0 -5
- package/templates/content_publisher/README.md +58 -0
- package/templates/content_publisher/canva-app.json +17 -0
- package/templates/content_publisher/declarations/declarations.d.ts +29 -0
- package/templates/content_publisher/eslint.config.mjs +14 -0
- package/templates/content_publisher/package.json +90 -0
- package/templates/content_publisher/scripts/copy_env.ts +13 -0
- package/templates/content_publisher/scripts/ssl/ssl.ts +131 -0
- package/templates/content_publisher/scripts/start/app_runner.ts +223 -0
- package/templates/content_publisher/scripts/start/context.ts +171 -0
- package/templates/content_publisher/scripts/start/start.ts +46 -0
- package/templates/content_publisher/src/index.tsx +4 -0
- package/templates/content_publisher/src/intents/content_publisher/index.tsx +113 -0
- package/templates/content_publisher/src/intents/content_publisher/post_preview.tsx +226 -0
- package/templates/content_publisher/src/intents/content_publisher/preview_ui.tsx +53 -0
- package/templates/content_publisher/src/intents/content_publisher/settings_ui.tsx +71 -0
- package/templates/content_publisher/src/intents/content_publisher/types.ts +29 -0
- package/templates/content_publisher/styles/components.css +56 -0
- package/templates/content_publisher/styles/preview_ui.css +88 -0
- package/templates/content_publisher/tsconfig.json +56 -0
- package/templates/content_publisher/webpack.config.ts +247 -0
- package/templates/dam/backend/server.ts +2 -3
- package/templates/dam/package.json +6 -5
- package/templates/dam/tsconfig.json +0 -1
- package/templates/dam/utils/backend/base_backend/create.ts +10 -0
- package/templates/dam/webpack.config.ts +0 -5
- package/templates/data_connector/package.json +5 -5
- package/templates/data_connector/tsconfig.json +0 -1
- package/templates/data_connector/webpack.config.ts +0 -5
- package/templates/gen_ai/backend/server.ts +2 -3
- package/templates/gen_ai/package.json +6 -5
- package/templates/gen_ai/tsconfig.json +0 -1
- package/templates/gen_ai/utils/backend/base_backend/create.ts +10 -0
- package/templates/gen_ai/webpack.config.ts +0 -5
- package/templates/hello_world/package.json +4 -4
- package/templates/hello_world/tsconfig.json +0 -1
- package/templates/hello_world/webpack.config.ts +0 -5
- package/templates/mls/package.json +5 -5
- package/templates/mls/tsconfig.json +0 -1
- package/templates/mls/webpack.config.ts +0 -5
- package/templates/base/backend/jwt_middleware/index.ts +0 -1
- package/templates/base/backend/jwt_middleware/jwt_middleware.ts +0 -224
- package/templates/dam/utils/backend/jwt_middleware/index.ts +0 -1
- package/templates/dam/utils/backend/jwt_middleware/jwt_middleware.ts +0 -224
- package/templates/gen_ai/utils/backend/jwt_middleware/index.ts +0 -1
- package/templates/gen_ai/utils/backend/jwt_middleware/jwt_middleware.ts +0 -224
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Avatar,
|
|
3
|
+
Box,
|
|
4
|
+
ImageCard,
|
|
5
|
+
Placeholder,
|
|
6
|
+
Rows,
|
|
7
|
+
Text,
|
|
8
|
+
TextPlaceholder,
|
|
9
|
+
} from "@canva/app-ui-kit";
|
|
10
|
+
import type { Preview, PreviewMedia } from "@canva/intents/content";
|
|
11
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
12
|
+
import * as styles from "../../../styles/preview_ui.css";
|
|
13
|
+
import type { PublishSettings } from "./types";
|
|
14
|
+
|
|
15
|
+
const IMAGE_WIDTH = 400;
|
|
16
|
+
|
|
17
|
+
interface PreviewProps {
|
|
18
|
+
previewMedia: PreviewMedia[] | undefined;
|
|
19
|
+
settings: PublishSettings | undefined;
|
|
20
|
+
username: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// TODO: Customize this preview to match what the published content will look like on your platform.
|
|
24
|
+
// This example shows a generic social media post with avatar, image, and caption.
|
|
25
|
+
// Consider: platform-specific dimensions, branding colors, and UI elements.
|
|
26
|
+
export const PostPreview = ({
|
|
27
|
+
previewMedia,
|
|
28
|
+
settings,
|
|
29
|
+
username,
|
|
30
|
+
}: PreviewProps) => {
|
|
31
|
+
const isLoading = !previewMedia;
|
|
32
|
+
|
|
33
|
+
const caption = settings?.caption;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Box
|
|
37
|
+
className={styles.wrapper}
|
|
38
|
+
background="surface"
|
|
39
|
+
borderRadius="large"
|
|
40
|
+
padding="2u"
|
|
41
|
+
border="standard"
|
|
42
|
+
>
|
|
43
|
+
<Rows spacing="2u">
|
|
44
|
+
<UserInfo isLoading={isLoading} username={username} />
|
|
45
|
+
<ImagePreview previewMedia={previewMedia} />
|
|
46
|
+
<Caption isLoading={isLoading} caption={caption} />
|
|
47
|
+
</Rows>
|
|
48
|
+
</Box>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Renders user profile information with avatar and username
|
|
53
|
+
const UserInfo = ({
|
|
54
|
+
isLoading,
|
|
55
|
+
username,
|
|
56
|
+
}: {
|
|
57
|
+
isLoading: boolean;
|
|
58
|
+
username: string;
|
|
59
|
+
}) => {
|
|
60
|
+
return (
|
|
61
|
+
<div className={styles.user}>
|
|
62
|
+
<Box className={styles.avatar}>
|
|
63
|
+
<Avatar name={username} />
|
|
64
|
+
</Box>
|
|
65
|
+
{isLoading ? (
|
|
66
|
+
<div className={styles.textPlaceholder}>
|
|
67
|
+
<TextPlaceholder size="medium" />
|
|
68
|
+
</div>
|
|
69
|
+
) : (
|
|
70
|
+
<Text size="small" variant="bold">
|
|
71
|
+
{username}
|
|
72
|
+
</Text>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Renders the post caption with username
|
|
79
|
+
const Caption = ({
|
|
80
|
+
isLoading,
|
|
81
|
+
caption,
|
|
82
|
+
}: {
|
|
83
|
+
isLoading: boolean;
|
|
84
|
+
caption: string | undefined;
|
|
85
|
+
}) => {
|
|
86
|
+
return (
|
|
87
|
+
<>
|
|
88
|
+
{isLoading ? (
|
|
89
|
+
<div className={styles.textPlaceholder}>
|
|
90
|
+
<TextPlaceholder size="medium" />
|
|
91
|
+
</div>
|
|
92
|
+
) : (
|
|
93
|
+
caption && (
|
|
94
|
+
<Text lineClamp={2} size="small">
|
|
95
|
+
{caption}
|
|
96
|
+
</Text>
|
|
97
|
+
)
|
|
98
|
+
)}
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Renders a single image post preview
|
|
104
|
+
const ImagePreview = ({
|
|
105
|
+
previewMedia,
|
|
106
|
+
}: {
|
|
107
|
+
previewMedia: PreviewMedia[] | undefined;
|
|
108
|
+
}) => {
|
|
109
|
+
const isLoading = !previewMedia;
|
|
110
|
+
const media = previewMedia?.find((media) => media.mediaSlotId === "media");
|
|
111
|
+
const fullWidth = (media?.previews.length ?? 1) * IMAGE_WIDTH;
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Box borderRadius="large" className={styles.imageContainer}>
|
|
115
|
+
{isLoading || !media?.previews.length ? (
|
|
116
|
+
<div className={styles.imagePlaceholder}>
|
|
117
|
+
<Placeholder shape="rectangle" />
|
|
118
|
+
</div>
|
|
119
|
+
) : (
|
|
120
|
+
<div className={styles.imageRow} style={{ width: fullWidth }}>
|
|
121
|
+
{media?.previews.map((p) => {
|
|
122
|
+
return (
|
|
123
|
+
<div key={p.id} className={styles.image}>
|
|
124
|
+
<PreviewRenderer preview={p} />
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
})}
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
</Box>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Renders individual preview based on its type and status
|
|
135
|
+
const PreviewRenderer = ({ preview }: { preview: Preview }) => {
|
|
136
|
+
const intl = useIntl();
|
|
137
|
+
// Handle different preview states
|
|
138
|
+
if (preview.status === "loading") {
|
|
139
|
+
return (
|
|
140
|
+
<ImageStatusText
|
|
141
|
+
text={intl.formatMessage({
|
|
142
|
+
defaultMessage: "Loading...",
|
|
143
|
+
description: "Text displayed while the preview is loading",
|
|
144
|
+
})}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (preview.status === "error") {
|
|
150
|
+
return (
|
|
151
|
+
<ImageStatusText
|
|
152
|
+
text={intl.formatMessage({
|
|
153
|
+
defaultMessage: "Error loading preview",
|
|
154
|
+
description:
|
|
155
|
+
"Text displayed when there is an error loading the preview",
|
|
156
|
+
})}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Handle image previews (ready status)
|
|
162
|
+
if (isImagePreviewReady(preview)) {
|
|
163
|
+
return (
|
|
164
|
+
<ImageCard
|
|
165
|
+
alt={intl.formatMessage(
|
|
166
|
+
{
|
|
167
|
+
defaultMessage: "Image preview {previewId}",
|
|
168
|
+
description: "Alt text for image preview in the preview UI",
|
|
169
|
+
},
|
|
170
|
+
{ previewId: preview.id },
|
|
171
|
+
)}
|
|
172
|
+
thumbnailUrl={preview.url}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Fallback for unknown preview types
|
|
178
|
+
return (
|
|
179
|
+
<Box
|
|
180
|
+
width="full"
|
|
181
|
+
height="full"
|
|
182
|
+
padding="2u"
|
|
183
|
+
display="flex"
|
|
184
|
+
alignItems="center"
|
|
185
|
+
justifyContent="center"
|
|
186
|
+
>
|
|
187
|
+
<Text size="medium" tone="tertiary" alignment="center">
|
|
188
|
+
<FormattedMessage
|
|
189
|
+
defaultMessage="Preview not available"
|
|
190
|
+
description="Text displayed when the preview type is not supported"
|
|
191
|
+
/>
|
|
192
|
+
</Text>
|
|
193
|
+
</Box>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// Helper component to display status text for loading/error states
|
|
198
|
+
const ImageStatusText = ({ text }: { text: string }) => (
|
|
199
|
+
<Box
|
|
200
|
+
width="full"
|
|
201
|
+
height="full"
|
|
202
|
+
padding="2u"
|
|
203
|
+
display="flex"
|
|
204
|
+
alignItems="center"
|
|
205
|
+
justifyContent="center"
|
|
206
|
+
>
|
|
207
|
+
<Text size="medium" tone="tertiary" alignment="center">
|
|
208
|
+
{text}
|
|
209
|
+
</Text>
|
|
210
|
+
</Box>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Type guard to check if a preview is an image preview that's ready to display
|
|
215
|
+
*/
|
|
216
|
+
export function isImagePreviewReady(preview: Preview): preview is Preview & {
|
|
217
|
+
kind: "image";
|
|
218
|
+
status: "ready";
|
|
219
|
+
url: string;
|
|
220
|
+
} {
|
|
221
|
+
return (
|
|
222
|
+
preview.kind === "image" &&
|
|
223
|
+
preview.status === "ready" &&
|
|
224
|
+
preview.url != null
|
|
225
|
+
);
|
|
226
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { OutputType, PreviewMedia } from "@canva/intents/content";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import * as styles from "../../../styles/preview_ui.css";
|
|
4
|
+
import { PostPreview } from "./post_preview";
|
|
5
|
+
import { parsePublishSettings } from "./types";
|
|
6
|
+
|
|
7
|
+
interface PreviewUiProps {
|
|
8
|
+
registerOnPreviewChange: (
|
|
9
|
+
callback: (opts: {
|
|
10
|
+
previewMedia: PreviewMedia[];
|
|
11
|
+
outputType: OutputType;
|
|
12
|
+
publishRef?: string;
|
|
13
|
+
}) => void,
|
|
14
|
+
) => () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// TODO: Replace with real user data from your platform
|
|
18
|
+
// After implementing authentication (see README), fetch the connected user's profile
|
|
19
|
+
// to display their actual username and avatar in the preview.
|
|
20
|
+
const username = "username";
|
|
21
|
+
|
|
22
|
+
// Main preview UI component that receives preview updates when settings or pages change.
|
|
23
|
+
// Preview UI is more flexible to align with your platform's design system, so it is not constrained to the Canva design system.
|
|
24
|
+
export const PreviewUi = ({ registerOnPreviewChange }: PreviewUiProps) => {
|
|
25
|
+
const [previewData, setPreviewData] = useState<{
|
|
26
|
+
previewMedia: PreviewMedia[];
|
|
27
|
+
outputType: OutputType;
|
|
28
|
+
publishRef?: string;
|
|
29
|
+
} | null>(null);
|
|
30
|
+
|
|
31
|
+
// Register to receive preview updates whenever settings or pages change
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const dispose = registerOnPreviewChange((data) => {
|
|
34
|
+
setPreviewData(data);
|
|
35
|
+
});
|
|
36
|
+
return dispose;
|
|
37
|
+
}, [registerOnPreviewChange]);
|
|
38
|
+
|
|
39
|
+
const { previewMedia, publishRef, outputType } = previewData ?? {};
|
|
40
|
+
const publishSettings = parsePublishSettings(publishRef);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className={styles.container}>
|
|
44
|
+
{outputType?.id === "post" && (
|
|
45
|
+
<PostPreview
|
|
46
|
+
previewMedia={previewMedia}
|
|
47
|
+
settings={publishSettings}
|
|
48
|
+
username={username}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FormField, Rows, Text, TextInput } from "@canva/app-ui-kit";
|
|
2
|
+
import type {
|
|
3
|
+
PublishRefValidityState,
|
|
4
|
+
RenderSettingsUiRequest,
|
|
5
|
+
SettingsUiContext,
|
|
6
|
+
} from "@canva/intents/content";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { useIntl } from "react-intl";
|
|
9
|
+
import * as styles from "styles/components.css";
|
|
10
|
+
import type { PublishSettings } from "./types";
|
|
11
|
+
|
|
12
|
+
// Settings UI component for configuring publish settings
|
|
13
|
+
export const SettingsUi = ({
|
|
14
|
+
updatePublishSettings,
|
|
15
|
+
registerOnSettingsUiContextChange,
|
|
16
|
+
}: RenderSettingsUiRequest) => {
|
|
17
|
+
const intl = useIntl();
|
|
18
|
+
const [settings, setSettings] = useState<PublishSettings>({ caption: "" });
|
|
19
|
+
const [settingsUiContext, setSettingsUiContext] =
|
|
20
|
+
useState<SettingsUiContext | null>(null);
|
|
21
|
+
|
|
22
|
+
// Listen for settings UI context changes (e.g., when output type changes)
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const dispose = registerOnSettingsUiContextChange((context) => {
|
|
25
|
+
setSettingsUiContext(context);
|
|
26
|
+
});
|
|
27
|
+
return dispose;
|
|
28
|
+
}, [registerOnSettingsUiContextChange]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className={styles.scrollContainer}>
|
|
32
|
+
<Rows spacing="2u">
|
|
33
|
+
{settingsUiContext?.outputType.displayName && (
|
|
34
|
+
<Text>{settingsUiContext?.outputType.displayName}</Text>
|
|
35
|
+
)}
|
|
36
|
+
<FormField
|
|
37
|
+
label={intl.formatMessage({
|
|
38
|
+
defaultMessage: "Caption",
|
|
39
|
+
description: "Label for the caption input field",
|
|
40
|
+
})}
|
|
41
|
+
control={(props) => (
|
|
42
|
+
<TextInput
|
|
43
|
+
{...props}
|
|
44
|
+
value={settings.caption}
|
|
45
|
+
onChange={(caption) => {
|
|
46
|
+
const updatedSettings = { ...settings, caption };
|
|
47
|
+
setSettings(updatedSettings);
|
|
48
|
+
updatePublishSettings({
|
|
49
|
+
publishRef: JSON.stringify(settings),
|
|
50
|
+
validityState: validatePublishRef(settings),
|
|
51
|
+
});
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
/>
|
|
56
|
+
</Rows>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Validates the publish settings to enable/disable the publish button
|
|
62
|
+
// Returns "valid" when all required fields are filled
|
|
63
|
+
const validatePublishRef = (
|
|
64
|
+
publishRef: PublishSettings,
|
|
65
|
+
): PublishRefValidityState => {
|
|
66
|
+
// caption is required
|
|
67
|
+
if (publishRef.caption.length === 0) {
|
|
68
|
+
return "invalid_missing_required_fields";
|
|
69
|
+
}
|
|
70
|
+
return "valid";
|
|
71
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definition for publish settings.
|
|
3
|
+
* These settings are serialized and passed between different parts of the publish flow.
|
|
4
|
+
* In production, include all platform-specific settings needed for publishing.
|
|
5
|
+
*/
|
|
6
|
+
export interface PublishSettings {
|
|
7
|
+
caption: string;
|
|
8
|
+
// TODO: Add additional fields for your platform's publishing requirements
|
|
9
|
+
// Examples:
|
|
10
|
+
// scheduledTime: Date;
|
|
11
|
+
// visibility: "public" | "private" | "unlisted";
|
|
12
|
+
// tags: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Utility function to safely parse publish settings from a JSON string.
|
|
17
|
+
* This is used to deserialize settings that were passed through the publish flow.
|
|
18
|
+
*/
|
|
19
|
+
export function parsePublishSettings(
|
|
20
|
+
publishRef?: string,
|
|
21
|
+
): PublishSettings | undefined {
|
|
22
|
+
if (!publishRef) return undefined;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(publishRef) as PublishSettings;
|
|
26
|
+
} catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* Scroll container */
|
|
2
|
+
.scrollContainer {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
overflow-y: scroll;
|
|
5
|
+
height: 100%;
|
|
6
|
+
padding-top: var(--ui-kit-space-200);
|
|
7
|
+
padding-right: var(--ui-kit-space-200);
|
|
8
|
+
padding-bottom: var(--ui-kit-space-200);
|
|
9
|
+
|
|
10
|
+
/* for firefox */
|
|
11
|
+
scrollbar-width: thin;
|
|
12
|
+
scrollbar-color: var(--ui-kit-color-content-placeholder-fg) transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.scrollContainer::-webkit-scrollbar {
|
|
16
|
+
position: absolute;
|
|
17
|
+
width: var(--ui-kit-base-unit);
|
|
18
|
+
height: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.scrollContainer::-webkit-scrollbar-track {
|
|
22
|
+
background: transparent;
|
|
23
|
+
width: var(--ui-kit-base-unit);
|
|
24
|
+
margin-top: var(--ui-kit-space-100);
|
|
25
|
+
margin-bottom: var(--ui-kit-space-100);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.scrollContainer::-webkit-scrollbar-thumb {
|
|
29
|
+
border-radius: var(--ui-kit-radius-element-standard);
|
|
30
|
+
background: var(--ui-kit-color-content-placeholder-fg);
|
|
31
|
+
visibility: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.scrollContainer:hover::-webkit-scrollbar-thumb,
|
|
35
|
+
.scrollContainer:focus::-webkit-scrollbar-thumb,
|
|
36
|
+
.scrollContainer:focus-within::-webkit-scrollbar-thumb {
|
|
37
|
+
visibility: visible;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Main container for the content publisher preview UI */
|
|
41
|
+
.previewContainer {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Wrapper for the content publisher post preview */
|
|
51
|
+
.previewWrapper {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
width: calc(400px + 32px + 2px); /* Image width + padding + border */
|
|
56
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* Main container for the preview UI */
|
|
2
|
+
.container {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Scale down preview on mobile devices */
|
|
12
|
+
@media (max-width: 600px) {
|
|
13
|
+
.container {
|
|
14
|
+
transform: scale(0.3);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Wrapper for the social media post preview */
|
|
19
|
+
.wrapper {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
width: calc(400px + 32px + 2px); /* Image width + padding + border */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* User profile section styling */
|
|
27
|
+
.user {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Avatar styling to match social media appearance */
|
|
34
|
+
.avatar {
|
|
35
|
+
transform: scale(0.6);
|
|
36
|
+
width: 24px;
|
|
37
|
+
height: 24px;
|
|
38
|
+
transform-origin: top left;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.avatarImage {
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
object-fit: cover;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Text placeholder for loading states */
|
|
48
|
+
.textPlaceholder {
|
|
49
|
+
min-width: calc(8 * 20);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Container for media images */
|
|
53
|
+
.imageContainer {
|
|
54
|
+
overflow: hidden; /* Enable border radius */
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Row containing all images */
|
|
58
|
+
.imageRow {
|
|
59
|
+
overflow-y: hidden;
|
|
60
|
+
overflow-x: auto;
|
|
61
|
+
height: 400px;
|
|
62
|
+
display: flex;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Aspect ratio helpers for different image formats */
|
|
66
|
+
.aspect-1-1 {
|
|
67
|
+
padding-top: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.aspect-3-4 {
|
|
71
|
+
padding-top: 133.33%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Individual image and placeholder styling */
|
|
75
|
+
.imagePlaceholder,
|
|
76
|
+
.image {
|
|
77
|
+
width: 400px;
|
|
78
|
+
height: 400px;
|
|
79
|
+
object-fit: cover;
|
|
80
|
+
display: inline-block;
|
|
81
|
+
position: relative;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Icon placeholder styling */
|
|
85
|
+
.iconPlaceholder {
|
|
86
|
+
width: 24px;
|
|
87
|
+
height: 24px;
|
|
88
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"es2018",
|
|
8
|
+
"es2019.array",
|
|
9
|
+
"es2019.object",
|
|
10
|
+
"es2019.string",
|
|
11
|
+
"es2020.promise",
|
|
12
|
+
"es2020.string"
|
|
13
|
+
],
|
|
14
|
+
"types": ["node", "webpack-env", "jest"],
|
|
15
|
+
"composite": false,
|
|
16
|
+
"declaration": false,
|
|
17
|
+
"declarationMap": false,
|
|
18
|
+
"experimentalDecorators": true,
|
|
19
|
+
"importHelpers": true,
|
|
20
|
+
"noImplicitOverride": true,
|
|
21
|
+
"moduleResolution": "bundler",
|
|
22
|
+
"esModuleInterop": true,
|
|
23
|
+
"rootDir": ".",
|
|
24
|
+
"outDir": "dist",
|
|
25
|
+
"strict": true,
|
|
26
|
+
"skipLibCheck": true,
|
|
27
|
+
"target": "ES2019",
|
|
28
|
+
"sourceMap": true,
|
|
29
|
+
"inlineSources": true,
|
|
30
|
+
"module": "ESNext",
|
|
31
|
+
"noImplicitAny": true,
|
|
32
|
+
"noImplicitReturns": true,
|
|
33
|
+
"noFallthroughCasesInSwitch": true,
|
|
34
|
+
"noUncheckedIndexedAccess": true,
|
|
35
|
+
"removeComments": true,
|
|
36
|
+
"preserveConstEnums": true,
|
|
37
|
+
"allowSyntheticDefaultImports": true,
|
|
38
|
+
"baseUrl": "./",
|
|
39
|
+
"paths": {
|
|
40
|
+
"styles": ["./styles"]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"include": [
|
|
44
|
+
"./src/**/*",
|
|
45
|
+
"./backend/**/*",
|
|
46
|
+
"./utils/**/*",
|
|
47
|
+
"./scripts/**/*",
|
|
48
|
+
"./declarations/declarations.d.ts",
|
|
49
|
+
"./styles/**/*"
|
|
50
|
+
],
|
|
51
|
+
"ts-node": {
|
|
52
|
+
"compilerOptions": {
|
|
53
|
+
"module": "commonjs"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|