mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 05:59:34 +02:00
[Video Change-speed tool] Initial commit
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { expect, describe, it } from 'vitest';
|
||||
// import { main } from './service';
|
||||
//
|
||||
// describe('change-speed', () => {
|
||||
//
|
||||
// })
|
62
src/pages/tools/video/change-speed/index.tsx
Normal file
62
src/pages/tools/video/change-speed/index.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Box } from '@mui/material';
|
||||
import React, { useState } from 'react';
|
||||
import ToolContent from '@components/ToolContent';
|
||||
import { ToolComponentProps } from '@tools/defineTool';
|
||||
import ToolTextInput from '@components/input/ToolTextInput';
|
||||
import ToolTextResult from '@components/result/ToolTextResult';
|
||||
import { GetGroupsType } from '@components/options/ToolOptions';
|
||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||
import { main } from './service';
|
||||
import { InitialValuesType } from './types';
|
||||
|
||||
const initialValues: InitialValuesType = {
|
||||
// splitSeparator: '\n'
|
||||
};
|
||||
|
||||
const exampleCards: CardExampleType<InitialValuesType>[] = [
|
||||
{
|
||||
title: 'Split a String',
|
||||
description: 'This example shows how to split a string into multiple lines',
|
||||
sampleText: 'Hello World,Hello World',
|
||||
sampleResult: `Hello World
|
||||
Hello World`,
|
||||
sampleOptions: {
|
||||
// splitSeparator: ','
|
||||
}
|
||||
}
|
||||
];
|
||||
export default function ChangeSpeed({
|
||||
title,
|
||||
longDescription
|
||||
}: ToolComponentProps) {
|
||||
const [input, setInput] = useState<string>('');
|
||||
const [result, setResult] = useState<string>('');
|
||||
|
||||
const compute = (values: InitialValuesType, input: string) => {
|
||||
setResult(main(input, values));
|
||||
};
|
||||
|
||||
const getGroups: GetGroupsType<InitialValuesType> | null = ({
|
||||
values,
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: 'Example Settings',
|
||||
component: <Box></Box>
|
||||
}
|
||||
];
|
||||
return (
|
||||
<ToolContent
|
||||
title={title}
|
||||
input={input}
|
||||
inputComponent={<ToolTextInput value={input} onChange={setInput} />}
|
||||
resultComponent={<ToolTextResult value={result} />}
|
||||
initialValues={initialValues}
|
||||
exampleCards={exampleCards}
|
||||
getGroups={getGroups}
|
||||
setInput={setInput}
|
||||
compute={compute}
|
||||
toolInfo={{ title: `What is a ${title}?`, description: longDescription }}
|
||||
/>
|
||||
);
|
||||
}
|
13
src/pages/tools/video/change-speed/meta.ts
Normal file
13
src/pages/tools/video/change-speed/meta.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { defineTool } from '@tools/defineTool';
|
||||
import { lazy } from 'react';
|
||||
|
||||
export const tool = defineTool('video', {
|
||||
name: 'Change speed',
|
||||
path: 'change-speed',
|
||||
icon: '',
|
||||
description: '',
|
||||
shortDescription: '',
|
||||
keywords: ['change', 'speed'],
|
||||
longDescription: '',
|
||||
component: lazy(() => import('./index'))
|
||||
});
|
5
src/pages/tools/video/change-speed/service.ts
Normal file
5
src/pages/tools/video/change-speed/service.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { InitialValuesType } from './types';
|
||||
|
||||
export function main(input: string, options: InitialValuesType): string {
|
||||
return input;
|
||||
}
|
3
src/pages/tools/video/change-speed/types.ts
Normal file
3
src/pages/tools/video/change-speed/types.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export type InitialValuesType = {
|
||||
// splitSeparator: string;
|
||||
};
|
@@ -1,3 +1,4 @@
|
||||
import { tool as videoChangeSpeed } from './change-speed/meta';
|
||||
import { tool as videoFlip } from './flip/meta';
|
||||
import { rotate } from '../string/rotate/service';
|
||||
import { gifTools } from './gif';
|
||||
|
Reference in New Issue
Block a user