mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Generate cover image (#376)
* Make mutating metadata ops mutation * Implement scene generate screenshot * Remove fetch policy on metadata mutations * Port UI changes to v2.5 * Set generated image in database
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Button } from "react-bootstrap";
|
||||
import React, { FunctionComponent } from "react";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
import { StashService } from "src/core/StashService";
|
||||
import { useToast } from "src/hooks";
|
||||
import { JWUtils } from "src/utils";
|
||||
|
||||
interface IOperationsPanelProps {
|
||||
scene: GQL.SceneDataFragment;
|
||||
}
|
||||
|
||||
export const SceneOperationsPanel: FunctionComponent<IOperationsPanelProps> = (props: IOperationsPanelProps) => {
|
||||
const Toast = useToast();
|
||||
const [generateScreenshot] = StashService.useSceneGenerateScreenshot();
|
||||
|
||||
async function onGenerateScreenshot(at?: number) {
|
||||
await generateScreenshot({
|
||||
variables: {
|
||||
id: props.scene.id,
|
||||
at: at
|
||||
}
|
||||
});
|
||||
Toast.success({ content: "Generating screenshot" });
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button className="edit-button" onClick={() => onGenerateScreenshot(JWUtils.getPlayer().getPosition())}>
|
||||
Generate thumbnail from current
|
||||
</Button>
|
||||
<Button className="edit-button" onClick={() => onGenerateScreenshot()}>
|
||||
Generate default thumbnail
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user