mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 14:09:31 +02:00
chore: rotation options
This commit is contained in:
182
.idea/workspace.xml
generated
182
.idea/workspace.xml
generated
@@ -5,7 +5,10 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="refactor: time between dates">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="refactor: time between dates">
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/time/time-between-dates/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/time/time-between-dates/meta.ts" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/components/BackButton.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools-by-category/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools-by-category/index.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/video/rotate/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/video/rotate/index.tsx" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -22,7 +25,7 @@
|
|||||||
<option name="PUSH_AUTO_UPDATE" value="true" />
|
<option name="PUSH_AUTO_UPDATE" value="true" />
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
<map>
|
<map>
|
||||||
<entry key="$PROJECT_DIR$" value="main" />
|
<entry key="$PROJECT_DIR$" value="fork/lfsjesus/feature/rotate-video" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
@@ -41,66 +44,73 @@
|
|||||||
"state": "OPEN"
|
"state": "OPEN"
|
||||||
}
|
}
|
||||||
}</component>
|
}</component>
|
||||||
<component name="GitHubPullRequestState">{
|
<component name="GitHubPullRequestState"><![CDATA[{
|
||||||
"prStates": [
|
"prStates": [
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts51PkS9",
|
"id": "PR_kwDOMJIfts51PkS9",
|
||||||
"number": 22
|
"number": 22
|
||||||
},
|
},
|
||||||
"lastSeen": 1741207144695
|
"lastSeen": 1741207144695
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6NiNYl",
|
"id": "PR_kwDOMJIfts6NiNYl",
|
||||||
"number": 32
|
"number": 32
|
||||||
},
|
},
|
||||||
"lastSeen": 1741209723869
|
"lastSeen": 1741209723869
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6Nheyd",
|
"id": "PR_kwDOMJIfts6Nheyd",
|
||||||
"number": 31
|
"number": 31
|
||||||
},
|
},
|
||||||
"lastSeen": 1741213371410
|
"lastSeen": 1741213371410
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6NmRBs",
|
"id": "PR_kwDOMJIfts6NmRBs",
|
||||||
"number": 33
|
"number": 33
|
||||||
},
|
},
|
||||||
"lastSeen": 1741282429036
|
"lastSeen": 1741282429036
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts5zyFTs",
|
"id": "PR_kwDOMJIfts5zyFTs",
|
||||||
"number": 15
|
"number": 15
|
||||||
},
|
},
|
||||||
"lastSeen": 1741535540953
|
"lastSeen": 1741535540953
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QQB3c",
|
"id": "PR_kwDOMJIfts6QQB3c",
|
||||||
"number": 59
|
"number": 59
|
||||||
},
|
},
|
||||||
"lastSeen": 1743018960900
|
"lastSeen": 1743018960900
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QMPEg",
|
"id": "PR_kwDOMJIfts6QMPEg",
|
||||||
"number": 58
|
"number": 58
|
||||||
},
|
},
|
||||||
"lastSeen": 1743019452983
|
"lastSeen": 1743019452983
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": {
|
"id": {
|
||||||
"id": "PR_kwDOMJIfts6QZvRI",
|
"id": "PR_kwDOMJIfts6QZvRI",
|
||||||
"number": 61
|
"number": 61
|
||||||
},
|
},
|
||||||
"lastSeen": 1743103196866
|
"lastSeen": 1743103196866
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": {
|
||||||
|
"id": "PR_kwDOMJIfts6QqPrQ",
|
||||||
|
"number": 73
|
||||||
|
},
|
||||||
|
"lastSeen": 1743265865001
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="GithubPullRequestsUISettings">{
|
<component name="GithubPullRequestsUISettings">{
|
||||||
"selectedUrlAndAccountId": {
|
"selectedUrlAndAccountId": {
|
||||||
"url": "https://github.com/iib0011/omni-tools.git",
|
"url": "https://github.com/iib0011/omni-tools.git",
|
||||||
@@ -129,56 +139,56 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"Docker.Dockerfile build.executor": "Run",
|
"Docker.Dockerfile build.executor": "Run",
|
||||||
"Docker.Dockerfile.executor": "Run",
|
"Docker.Dockerfile.executor": "Run",
|
||||||
"Playwright.Create transparent PNG.should make png color transparent.executor": "Run",
|
"Playwright.Create transparent PNG.should make png color transparent.executor": "Run",
|
||||||
"Playwright.JoinText Component.executor": "Run",
|
"Playwright.JoinText Component.executor": "Run",
|
||||||
"Playwright.JoinText Component.should merge text pieces with specified join character.executor": "Run",
|
"Playwright.JoinText Component.should merge text pieces with specified join character.executor": "Run",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"Vitest.compute function (1).executor": "Run",
|
"Vitest.compute function (1).executor": "Run",
|
||||||
"Vitest.compute function.executor": "Run",
|
"Vitest.compute function.executor": "Run",
|
||||||
"Vitest.mergeText.executor": "Run",
|
"Vitest.mergeText.executor": "Run",
|
||||||
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
|
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
|
||||||
"Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
|
"Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
|
||||||
"Vitest.parsePageRanges.executor": "Run",
|
"Vitest.parsePageRanges.executor": "Run",
|
||||||
"Vitest.removeDuplicateLines function.executor": "Run",
|
"Vitest.removeDuplicateLines function.executor": "Run",
|
||||||
"Vitest.removeDuplicateLines function.newlines option.executor": "Run",
|
"Vitest.removeDuplicateLines function.newlines option.executor": "Run",
|
||||||
"Vitest.removeDuplicateLines function.newlines option.should filter newlines when newlines is set to filter.executor": "Run",
|
"Vitest.removeDuplicateLines function.newlines option.should filter newlines when newlines is set to filter.executor": "Run",
|
||||||
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
|
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
|
||||||
"Vitest.replaceText function.executor": "Run",
|
"Vitest.replaceText function.executor": "Run",
|
||||||
"Vitest.timeBetweenDates.executor": "Run",
|
"Vitest.timeBetweenDates.executor": "Run",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src/components/input",
|
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src/components/input",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"npm.build.executor": "Run",
|
"npm.build.executor": "Run",
|
||||||
"npm.dev.executor": "Run",
|
"npm.dev.executor": "Run",
|
||||||
"npm.lint.executor": "Run",
|
"npm.lint.executor": "Run",
|
||||||
"npm.prebuild.executor": "Run",
|
"npm.prebuild.executor": "Run",
|
||||||
"npm.script:create:tool.executor": "Run",
|
"npm.script:create:tool.executor": "Run",
|
||||||
"npm.test.executor": "Run",
|
"npm.test.executor": "Run",
|
||||||
"npm.test:e2e.executor": "Run",
|
"npm.test:e2e.executor": "Run",
|
||||||
"npm.test:e2e:run.executor": "Run",
|
"npm.test:e2e:run.executor": "Run",
|
||||||
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\prettier",
|
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\prettier",
|
||||||
"project.structure.last.edited": "Problems",
|
"project.structure.last.edited": "Problems",
|
||||||
"project.structure.proportion": "0.0",
|
"project.structure.proportion": "0.0",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.side.proportion": "0.2",
|
||||||
"settings.editor.selected.configurable": "refactai_advanced_settings",
|
"settings.editor.selected.configurable": "refactai_advanced_settings",
|
||||||
"ts.external.directory.path": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
|
"ts.external.directory.path": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="ReactDesignerToolWindowState">
|
<component name="ReactDesignerToolWindowState">
|
||||||
<option name="myId2Visible">
|
<option name="myId2Visible">
|
||||||
<map>
|
<map>
|
||||||
|
20
src/components/BackButton.tsx
Normal file
20
src/components/BackButton.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { IconButton } from '@mui/material';
|
||||||
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||||
|
import { useNavigate, useNavigationType } from 'react-router-dom';
|
||||||
|
|
||||||
|
const BackButton = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const navigationType = useNavigationType(); // Check if there is a history state
|
||||||
|
const disabled = navigationType === 'POP';
|
||||||
|
const handleBack = () => {
|
||||||
|
navigate(-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IconButton onClick={handleBack} disabled={disabled}>
|
||||||
|
<ArrowBackIcon color={disabled ? 'action' : 'primary'} />
|
||||||
|
</IconButton>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BackButton;
|
@@ -8,6 +8,10 @@ import { capitalizeFirstLetter } from '@utils/string';
|
|||||||
import { Icon } from '@iconify/react';
|
import { Icon } from '@iconify/react';
|
||||||
import { categoriesColors } from 'config/uiConfig';
|
import { categoriesColors } from 'config/uiConfig';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
import IconButton from '@mui/material/IconButton';
|
||||||
|
import { ArrowBack } from '@mui/icons-material';
|
||||||
|
import BackButton from '@components/BackButton';
|
||||||
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -35,10 +39,15 @@ export default function Home() {
|
|||||||
</Box>
|
</Box>
|
||||||
<Divider sx={{ borderColor: theme.palette.primary.main }} />
|
<Divider sx={{ borderColor: theme.palette.primary.main }} />
|
||||||
<Box ref={mainContentRef} mt={3} ml={{ xs: 1, md: 2, lg: 3 }} padding={3}>
|
<Box ref={mainContentRef} mt={3} ml={{ xs: 1, md: 2, lg: 3 }} padding={3}>
|
||||||
<Typography
|
<Stack direction={'row'} alignItems={'center'} spacing={1}>
|
||||||
fontSize={22}
|
<IconButton onClick={() => navigate('/')}>
|
||||||
color={theme.palette.primary.main}
|
<ArrowBackIcon color={'primary'} />
|
||||||
>{`All ${capitalizeFirstLetter(categoryName)} Tools`}</Typography>
|
</IconButton>
|
||||||
|
<Typography
|
||||||
|
fontSize={22}
|
||||||
|
color={theme.palette.primary.main}
|
||||||
|
>{`All ${capitalizeFirstLetter(categoryName)} Tools`}</Typography>
|
||||||
|
</Stack>
|
||||||
<Grid container spacing={2} mt={2}>
|
<Grid container spacing={2} mt={2}>
|
||||||
{getToolsByCategory()
|
{getToolsByCategory()
|
||||||
.find(({ type }) => type === categoryName)
|
.find(({ type }) => type === categoryName)
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import { useCallback, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import ToolFileResult from '@components/result/ToolFileResult';
|
import ToolFileResult from '@components/result/ToolFileResult';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import { ToolComponentProps } from '@tools/defineTool';
|
import { ToolComponentProps } from '@tools/defineTool';
|
||||||
import { GetGroupsType } from '@components/options/ToolOptions';
|
import { GetGroupsType } from '@components/options/ToolOptions';
|
||||||
import TextFieldWithDesc from '@components/options/TextFieldWithDesc';
|
|
||||||
import { updateNumberField } from '@utils/string';
|
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import ToolVideoInput from '@components/input/ToolVideoInput';
|
import ToolVideoInput from '@components/input/ToolVideoInput';
|
||||||
import { rotateVideo } from './service';
|
import { rotateVideo } from './service';
|
||||||
|
import { RotationAngle } from '../../pdf/rotate-pdf/types';
|
||||||
|
import SimpleRadio from '@components/options/SimpleRadio';
|
||||||
|
|
||||||
export const initialValues = {
|
export const initialValues = {
|
||||||
rotation: 90
|
rotation: 90
|
||||||
@@ -21,34 +21,28 @@ export const validationSchema = Yup.object({
|
|||||||
.required('Rotation is required')
|
.required('Rotation is required')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const angleOptions: { value: RotationAngle; label: string }[] = [
|
||||||
|
{ value: 90, label: '90° Clockwise' },
|
||||||
|
{ value: 180, label: '180° (Upside down)' },
|
||||||
|
{ value: 270, label: '270° (90° Counter-clockwise)' }
|
||||||
|
];
|
||||||
export default function RotateVideo({ title }: ToolComponentProps) {
|
export default function RotateVideo({ title }: ToolComponentProps) {
|
||||||
const [input, setInput] = useState<File | null>(null);
|
const [input, setInput] = useState<File | null>(null);
|
||||||
const [result, setResult] = useState<File | null>(null);
|
const [result, setResult] = useState<File | null>(null);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const compute = async (
|
const compute = async (
|
||||||
optionsValues: typeof initialValues,
|
optionsValues: typeof initialValues,
|
||||||
input: File | null
|
input: File | null
|
||||||
) => {
|
) => {
|
||||||
if (!input) return;
|
if (!input) return;
|
||||||
|
|
||||||
try {
|
|
||||||
await validationSchema.validate(optionsValues);
|
|
||||||
} catch (validationError) {
|
|
||||||
setError((validationError as Yup.ValidationError).message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError(null);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const rotatedFile = await rotateVideo(input, optionsValues.rotation);
|
const rotatedFile = await rotateVideo(input, optionsValues.rotation);
|
||||||
setResult(rotatedFile);
|
setResult(rotatedFile);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error rotating video:', error);
|
console.error('Error rotating video:', error);
|
||||||
setError('Failed to rotate video. Please try again.');
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -64,16 +58,16 @@ export default function RotateVideo({ title }: ToolComponentProps) {
|
|||||||
title: 'Rotation',
|
title: 'Rotation',
|
||||||
component: (
|
component: (
|
||||||
<Box>
|
<Box>
|
||||||
<TextFieldWithDesc
|
{angleOptions.map((angleOption) => (
|
||||||
onOwnChange={(value) =>
|
<SimpleRadio
|
||||||
updateNumberField(value, 'rotation', updateField)
|
key={angleOption.value}
|
||||||
}
|
title={angleOption.label}
|
||||||
value={values.rotation}
|
checked={values.rotation === angleOption.value}
|
||||||
label={'Rotation (degrees)'}
|
onClick={() => {
|
||||||
helperText={error || 'Valid values: 0, 90, 180, 270'}
|
updateField('rotation', angleOption.value);
|
||||||
error={!!error}
|
}}
|
||||||
sx={{ mb: 2, backgroundColor: 'white' }}
|
/>
|
||||||
/>
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -83,14 +77,14 @@ export default function RotateVideo({ title }: ToolComponentProps) {
|
|||||||
<ToolContent
|
<ToolContent
|
||||||
title={title}
|
title={title}
|
||||||
input={input}
|
input={input}
|
||||||
renderCustomInput={(_, setFieldValue) => (
|
inputComponent={
|
||||||
<ToolVideoInput
|
<ToolVideoInput
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
accept={['video/mp4', 'video/webm', 'video/ogg']}
|
accept={['video/mp4', 'video/webm', 'video/ogg']}
|
||||||
title={'Input Video'}
|
title={'Input Video'}
|
||||||
/>
|
/>
|
||||||
)}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
loading ? (
|
loading ? (
|
||||||
<ToolFileResult
|
<ToolFileResult
|
||||||
|
Reference in New Issue
Block a user