[Video Change-speed tool] Initial commit

This commit is contained in:
C043
2025-05-22 22:48:29 +02:00
parent 2a9d3c4fda
commit 9a0ca5c611
6 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import { expect, describe, it } from 'vitest';
// import { main } from './service';
//
// describe('change-speed', () => {
//
// })

View 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 }}
/>
);
}

View 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'))
});

View File

@@ -0,0 +1,5 @@
import { InitialValuesType } from './types';
export function main(input: string, options: InitialValuesType): string {
return input;
}

View File

@@ -0,0 +1,3 @@
export type InitialValuesType = {
// splitSeparator: string;
};

View File

@@ -1,3 +1,4 @@
import { tool as videoChangeSpeed } from './change-speed/meta';
import { tool as videoFlip } from './flip/meta'; import { tool as videoFlip } from './flip/meta';
import { rotate } from '../string/rotate/service'; import { rotate } from '../string/rotate/service';
import { gifTools } from './gif'; import { gifTools } from './gif';