-
Notifications
You must be signed in to change notification settings - Fork 6
[CCEX-280564] Added new video quick actions picker component #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shairil
wants to merge
15
commits into
stage
Choose a base branch
from
frictionless-experiment
base: stage
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d556677
adding new component for video quick action picker
shairil849 de97ff0
minor fixes
shairil849 9bcc0ce
lint fixes
shairil849 2bf7469
updating vqa icons and integrated for iOS pages video editor and crea…
shairil849 1191901
fix linter
shairil849 9b2086f
fixed linter
shairil849 b438552
fixed linter 2
shairil849 c09f40f
fix linter 3
shairil849 a3284da
fixed linter 5
shairil849 d3ea5e5
removed the unused string
shairil849 2cca9e9
review comments
shairil849 d2ea3fe
fixed lints
shairil849 a9f1ac7
Merge branch 'stage' into frictionless-experiment
shairil849 65b3bb8
added new values to showwith section metadata to separate iOS and and…
shairil849 721ced2
Merge branch 'stage' into frictionless-experiment
shairil849 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
express/code/blocks/video-quick-action-picker/video-quick-action-picker-config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| import { getLibs } from '../../scripts/utils.js'; | ||
| import { QA_CONFIGS } from '../../scripts/utils/frictionless-utils.js'; | ||
|
|
||
| const ICONS_BASE = '/express/code/icons'; | ||
|
|
||
| export const ACTION_TYPES = { | ||
| QUICK_ACTION: 'quick-action', // launches SDK inline with the uploaded file | ||
| APP_INSTALL: 'app-install', // navigates to app install URL (same tab) | ||
| }; | ||
|
|
||
| // Max duration in seconds per quick action (source: Adobe Express help docs) | ||
| const MAX_DURATION = { | ||
| 'convert-to-gif': 60, // 1 minute | ||
| 'caption-video': 300, // 5 minutes | ||
| }; | ||
|
|
||
| let replaceKey; | ||
| let getConfig; | ||
|
|
||
| export async function loadPlaceholders() { | ||
| const [utils, placeholders] = await Promise.all([ | ||
| import(`${getLibs()}/utils/utils.js`), | ||
| import(`${getLibs()}/features/placeholders.js`), | ||
| ]); | ||
| ({ getConfig } = utils); | ||
| ({ replaceKey } = placeholders); | ||
| } | ||
|
|
||
| async function resolveKey(key, fallback) { | ||
| const resolved = await replaceKey(key, getConfig()); | ||
| if (resolved === key.replaceAll('-', ' ')) return fallback; | ||
| return resolved; | ||
| } | ||
|
|
||
| export async function getLocalizedStrings() { | ||
| return { | ||
| editVideo: await resolveKey('edit-video', 'Edit video'), | ||
| appOnly: await resolveKey('ios-app-only', 'iOS App only'), | ||
| convertVideoToGif: await resolveKey('convert-video-to-gif', 'Convert video to GIF'), | ||
| cropVideo: await resolveKey('crop-video', 'Crop video'), | ||
| trimVideo: await resolveKey('trim-video', 'Trim video'), | ||
| resizeVideo: await resolveKey('resize-video', 'Resize video'), | ||
| convertVideoToMp4: await resolveKey('convert-video-to-mp4', 'Convert video to MP4'), | ||
| captionVideo: await resolveKey('caption-video', 'Caption video'), | ||
| openingPreview: await resolveKey('opening-preview', 'Opening preview'), | ||
| uploadedVideo: await resolveKey('uploaded-video', 'Uploaded video'), | ||
| startFromYourVideo: await resolveKey('start-from-your-video', 'Start from your video'), | ||
| closeDialog: await resolveKey('close-dialog', 'Close dialog'), | ||
| }; | ||
| } | ||
|
|
||
| export function getVideoActions(strings, videoFile, videoDuration) { | ||
| const actions = [ | ||
| { | ||
| id: 'edit-video', | ||
| label: strings.editVideo, | ||
| badge: strings.appOnly, | ||
| type: ACTION_TYPES.APP_INSTALL, | ||
| iconPath: `${ICONS_BASE}/edit-video.svg`, | ||
| }, | ||
| { | ||
| id: 'convert-to-gif', | ||
| label: strings.convertVideoToGif, | ||
| type: ACTION_TYPES.QUICK_ACTION, | ||
| iconPath: `${ICONS_BASE}/ax-convert-to-gif-22.svg`, | ||
| }, | ||
| { | ||
| id: 'crop-video', | ||
| label: strings.cropVideo, | ||
| type: ACTION_TYPES.QUICK_ACTION, | ||
| iconPath: `${ICONS_BASE}/vqa-crop-video.svg`, | ||
| }, | ||
| { | ||
| id: 'trim-video', | ||
| label: strings.trimVideo, | ||
| type: ACTION_TYPES.QUICK_ACTION, | ||
| iconPath: `${ICONS_BASE}/vqa-trim-video.svg`, | ||
| }, | ||
| { | ||
| id: 'resize-video', | ||
| label: strings.resizeVideo, | ||
| type: ACTION_TYPES.QUICK_ACTION, | ||
| iconPath: `${ICONS_BASE}/vqa-resize-video.svg`, | ||
| }, | ||
| { | ||
| id: 'convert-to-mp4', | ||
| label: strings.convertVideoToMp4, | ||
| type: ACTION_TYPES.QUICK_ACTION, | ||
| iconPath: `${ICONS_BASE}/convert-to-mp4.svg`, | ||
| }, | ||
| { | ||
| id: 'caption-video', | ||
| label: strings.captionVideo, | ||
| type: ACTION_TYPES.QUICK_ACTION, | ||
| iconPath: `${ICONS_BASE}/ax-caption-video-22.svg`, | ||
| }, | ||
| ]; | ||
|
|
||
| return actions.filter((action) => { | ||
| // No point offering convert-to-mp4 if the file is already an MP4 | ||
| if (action.id === 'convert-to-mp4' && videoFile.type === 'video/mp4') return false; | ||
| const config = QA_CONFIGS[action.id]; | ||
| if (!config) return false; | ||
| if (!config.input_check(videoFile.type)) return false; | ||
| if (videoFile.size > config.max_size) return false; | ||
| const maxDuration = MAX_DURATION[action.id]; | ||
| if (maxDuration && videoDuration > maxDuration) return false; | ||
| return true; | ||
| }); | ||
| } |
212 changes: 212 additions & 0 deletions
212
express/code/blocks/video-quick-action-picker/video-quick-action-picker.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,212 @@ | ||
| /* --- Fullscreen Dialog --- */ | ||
| .vqap-dialog { | ||
| position: fixed; | ||
| inset: 0; | ||
| --vqap-mobile-header-bar-height: 53px; | ||
| --vqap-hero-inline-mobile-height: 282px; | ||
| background: var(--body-background-color); | ||
| display: flex; | ||
| flex-direction: column; | ||
| z-index: 9999; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| /* --- Close Button --- */ | ||
| .vqap-close-btn { | ||
| position: absolute; | ||
| inset-block-start: calc(var(--spacing-75) + env(safe-area-inset-top, 0px)); | ||
| inset-inline-end: var(--spacing-300); | ||
| width: 50px; | ||
| height: 50px; | ||
| border-radius: 100%; | ||
| border: 0; | ||
| background: transparent; | ||
| color: var(--color-white); | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| cursor: pointer; | ||
| z-index: 1; | ||
| } | ||
|
|
||
| /* --- Hero Container --- */ | ||
| .vqap-hero { | ||
| background: var(--color-gray-100); | ||
| height: var(--vqap-hero-inline-mobile-height); | ||
| width: 100%; | ||
| flex-shrink: 0; | ||
| margin-block-end: var(--spacing-400); | ||
| } | ||
|
|
||
| /* --- Header Bar --- */ | ||
|
|
||
| .vqap-header-bar { | ||
| height: var(--vqap-mobile-header-bar-height); | ||
| background-color: var(--color-gray-800-variant); | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| /* --- Preview Area --- */ | ||
| .vqap-preview-container { | ||
| -webkit-touch-callout: none; | ||
| -webkit-user-select: none; | ||
| user-select: none; | ||
| background-color: var(--color-gray-100); | ||
| box-sizing: border-box; | ||
| height: calc(100% - var(--vqap-mobile-header-bar-height)); | ||
| width: 100%; | ||
| padding: var(--spacing-300); | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .vqap-preview-container video { | ||
| width: 100%; | ||
| height: auto; | ||
| max-height: 100%; | ||
| max-width: 100%; | ||
| display: block; | ||
| object-fit: contain; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| /* --- Loading Spinner --- */ | ||
| .vqap-loading { | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| width: 100%; | ||
| height: 100%; | ||
| } | ||
|
|
||
| .vqap-spinner { | ||
| width: 48px; | ||
| height: 48px; | ||
| border: 4px solid var(--color-light-gray); | ||
| border-top-color: var(--color-gray-800-variant); | ||
| border-radius: 50%; | ||
| animation: vqap-spin 0.8s linear infinite; | ||
| } | ||
|
|
||
| @keyframes vqap-spin { | ||
| to { transform: rotate(360deg); } | ||
| } | ||
|
|
||
| /* --- Error State --- */ | ||
| .vqap-error { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; | ||
| gap: var(--spacing-100); | ||
| width: 100%; | ||
| height: 100%; | ||
| color: var(--color-default-font); | ||
| font-size: var(--ax-body-xs-size, 14px); | ||
| } | ||
|
|
||
| /* --- Scrollable Body & Content Container --- */ | ||
| .vqap-body { | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex: 1 1 auto; | ||
| min-height: 0; | ||
| } | ||
|
|
||
| .vqap-content-container { | ||
| padding-inline: var(--spacing-300); | ||
| flex: 1 1 auto; | ||
| overflow-y: auto; | ||
| -webkit-overflow-scrolling: touch; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--spacing-400); | ||
| padding-block: var(--spacing-50); | ||
| padding-bottom: calc(var(--spacing-50) + env(safe-area-inset-bottom, 0px)); | ||
| } | ||
|
|
||
| .vqap-content-container > .vqap-action-card:first-child { | ||
| margin-block-start: var(--spacing-75); | ||
| } | ||
|
|
||
| .vqap-content-container > .vqap-action-card:last-child { | ||
| margin-block-end: var(--spacing-300); | ||
| } | ||
|
|
||
| /* --- Action Card --- */ | ||
| .vqap-action-card { | ||
| -webkit-touch-callout: none; | ||
| -webkit-user-select: none; | ||
| user-select: none; | ||
| display: block; | ||
| width: 100%; | ||
| border: var(--border-width-2) solid var(--color-light-gray); | ||
| border-radius: var(--border-radius-10); | ||
| padding: var(--spacing-400) var(--spacing-300); | ||
| cursor: pointer; | ||
| background: var(--body-background-color); | ||
| box-sizing: border-box; | ||
| touch-action: manipulation; | ||
| } | ||
|
|
||
| .vqap-action-card:hover, | ||
| .vqap-action-card:active { | ||
| border-color: var(--color-gray-250); | ||
| } | ||
|
|
||
| /* --- Card Inner (mirrors .action-title) --- */ | ||
| .vqap-action-title { | ||
| align-items: center; | ||
| display: flex; | ||
| gap: var(--spacing-200); | ||
| padding-block: var(--spacing-75); | ||
| font-family: var(--body-font-family); | ||
| font-size: var(--ax-heading-xs-size, 16px); | ||
| line-height: var(--ax-heading-xs-lh, 20px); | ||
| } | ||
|
|
||
| .vqap-action-title span { | ||
| align-items: center; | ||
| display: flex; | ||
| gap: var(--spacing-100); | ||
| flex-wrap: wrap-reverse; | ||
| } | ||
|
|
||
| .vqap-action-title strong { | ||
| font-weight: var(--ax-heading-weight, 700); | ||
| color: var(--heading-color, var(--color-default-font)); | ||
| } | ||
|
|
||
| .vqap-card-icon { | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| .vqap-card-icon img { | ||
| width: 28px; | ||
| height: 28px; | ||
| } | ||
|
|
||
| .vqap-close-btn img { | ||
| width: 18px; | ||
| height: 18px; | ||
| } | ||
|
|
||
| /* --- Badge --- */ | ||
| .vqap-badge { | ||
| display: flex; | ||
| align-items: center; | ||
| min-height: 26px; | ||
| border: 1px solid transparent; | ||
| border-radius: 4px; | ||
| background: rgb(229, 240, 254); | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| .vqap-badge strong { | ||
| font-size: var(--ax-body-xs-size); | ||
| line-height: 1.3; | ||
| color: var(--color-black); | ||
| padding-block: var(--spacing-50); | ||
| padding-inline: var(--spacing-80); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.