Initial commit for new tool video to gif

This commit is contained in:
C043
2025-06-09 15:25:14 +02:00
parent d25f7ca557
commit 377dbc3685
6 changed files with 99 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import { tool as videoVideoToGif } from './video-to-gif/meta';
import { tool as videoChangeSpeed } from './change-speed/meta';
import { tool as videoFlip } from './flip/meta';
import { rotate } from '../string/rotate/service';
@@ -9,6 +10,7 @@ import { tool as loopVideo } from './loop/meta';
import { tool as flipVideo } from './flip/meta';
import { tool as cropVideo } from './crop-video/meta';
import { tool as changeSpeed } from './change-speed/meta';
import { tool as videoToGif } from './video-to-gif/meta';
export const videoTools = [
...gifTools,
@@ -18,5 +20,6 @@ export const videoTools = [
loopVideo,
flipVideo,
cropVideo,
changeSpeed
changeSpeed,
videoToGif
];

View File

@@ -0,0 +1,69 @@
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';
import ToolVideoInput from '@components/input/ToolVideoInput';
import ToolFileResult from '@components/result/ToolFileResult';
const initialValues: InitialValuesType = {
// splitSeparator: '\n'
};
export default function VideoToGif({
title,
longDescription
}: ToolComponentProps) {
const [input, setInput] = useState<File | null>(null);
const [result, setResult] = useState<File | null>(null);
const [loading, setIsLoading] = useState(false);
const compute = (values: InitialValuesType, input: File | null) => {
setResult(main(input, values));
};
const getGroups: GetGroupsType<InitialValuesType> | null = ({
values,
updateField
}) => [
{
title: 'Example Settings',
component: <Box></Box>
}
];
return (
<ToolContent
title={title}
input={input}
inputComponent={
<ToolVideoInput value={input} onChange={setInput} title="Input Video" />
}
resultComponent={
loading ? (
<ToolFileResult
title="Converting to Gif"
value={null}
loading={true}
/>
) : (
<ToolFileResult
title="Converted to Gif"
value={result}
extension="gif"
/>
)
}
initialValues={initialValues}
getGroups={getGroups}
setInput={setInput}
compute={compute}
toolInfo={{ title: `What is a ${title}?`, description: longDescription }}
/>
);
}

View File

@@ -0,0 +1,12 @@
import { defineTool } from '@tools/defineTool';
import { lazy } from 'react';
export const tool = defineTool('video', {
name: 'Video to Gif',
path: 'video-to-gif',
icon: 'fluent:gif-16-regular',
description: 'This online utility lets you convert a short video to gif.',
shortDescription: 'Quickly convert a short video to gif',
keywords: ['video', 'to', 'gif', 'convert'],
component: lazy(() => import('./index'))
});

View File

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

View File

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

View File

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