mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
Merge branch 'staging' of https://github.com/mazeincoding/AppCut into staging
This commit is contained in:
@@ -6,7 +6,8 @@ import { useTimelineStore } from "@/stores/timeline-store";
|
|||||||
import { Slider } from "@/components/ui/slider";
|
import { Slider } from "@/components/ui/slider";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useState } from "react";
|
import { Switch } from "@/components/ui/switch"; // Add Switch import
|
||||||
|
import { useState, useRef } from "react";
|
||||||
import {
|
import {
|
||||||
PropertyItem,
|
PropertyItem,
|
||||||
PropertyItemLabel,
|
PropertyItemLabel,
|
||||||
@@ -30,6 +31,9 @@ export function TextProperties({
|
|||||||
Math.round(element.opacity * 100).toString()
|
Math.round(element.opacity * 100).toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Track the last selected color for toggling
|
||||||
|
const lastSelectedColor = useRef("#000000");
|
||||||
|
|
||||||
const parseAndValidateNumber = (
|
const parseAndValidateNumber = (
|
||||||
value: string,
|
value: string,
|
||||||
min: number,
|
min: number,
|
||||||
@@ -86,6 +90,20 @@ export function TextProperties({
|
|||||||
updateTextElement(trackId, element.id, { opacity: opacityPercent / 100 });
|
updateTextElement(trackId, element.id, { opacity: opacityPercent / 100 });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Update last selected color when a new color is picked
|
||||||
|
const handleColorChange = (color: string) => {
|
||||||
|
if (color !== "transparent") {
|
||||||
|
lastSelectedColor.current = color;
|
||||||
|
}
|
||||||
|
updateTextElement(trackId, element.id, { backgroundColor: color });
|
||||||
|
};
|
||||||
|
|
||||||
|
// Toggle between transparent and last selected color
|
||||||
|
const handleTransparentToggle = (isTransparent: boolean) => {
|
||||||
|
const newColor = isTransparent ? "transparent" : lastSelectedColor.current;
|
||||||
|
updateTextElement(trackId, element.id, { backgroundColor: newColor });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6 p-5">
|
<div className="space-y-6 p-5">
|
||||||
<Textarea
|
<Textarea
|
||||||
@@ -220,21 +238,31 @@ export function TextProperties({
|
|||||||
/>
|
/>
|
||||||
</PropertyItemValue>
|
</PropertyItemValue>
|
||||||
</PropertyItem>
|
</PropertyItem>
|
||||||
<PropertyItem direction="row">
|
<PropertyItem direction="column">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
<PropertyItemLabel>Background</PropertyItemLabel>
|
<PropertyItemLabel>Background</PropertyItemLabel>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<Switch
|
||||||
|
id="transparent-bg-toggle"
|
||||||
|
checked={element.backgroundColor === "transparent"}
|
||||||
|
onCheckedChange={handleTransparentToggle}
|
||||||
|
/>
|
||||||
|
<label htmlFor="transparent-bg-toggle" className="text-sm font-medium">
|
||||||
|
Transparent
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<PropertyItemValue>
|
<PropertyItemValue>
|
||||||
<Input
|
<Input
|
||||||
type="color"
|
type="color"
|
||||||
value={
|
value={
|
||||||
element.backgroundColor === "transparent"
|
element.backgroundColor === "transparent"
|
||||||
? "#000000"
|
? lastSelectedColor.current
|
||||||
: element.backgroundColor || "#000000"
|
: element.backgroundColor || "#000000"
|
||||||
}
|
}
|
||||||
onChange={(e) => {
|
onChange={(e) => handleColorChange(e.target.value)}
|
||||||
const backgroundColor = e.target.value;
|
|
||||||
updateTextElement(trackId, element.id, { backgroundColor });
|
|
||||||
}}
|
|
||||||
className="w-full cursor-pointer rounded-full"
|
className="w-full cursor-pointer rounded-full"
|
||||||
|
disabled={element.backgroundColor === "transparent"}
|
||||||
/>
|
/>
|
||||||
</PropertyItemValue>
|
</PropertyItemValue>
|
||||||
</PropertyItem>
|
</PropertyItem>
|
||||||
|
|||||||
@@ -36,7 +36,13 @@ export function Footer() {
|
|||||||
{/* Brand Section */}
|
{/* Brand Section */}
|
||||||
<div className="md:col-span-1 max-w-sm">
|
<div className="md:col-span-1 max-w-sm">
|
||||||
<div className="flex justify-start items-center gap-2 mb-4">
|
<div className="flex justify-start items-center gap-2 mb-4">
|
||||||
<Image src="/logo.svg" alt="OpenCut" width={24} height={24} />
|
<Image
|
||||||
|
src="/logo.svg"
|
||||||
|
alt="OpenCut"
|
||||||
|
width={24}
|
||||||
|
height={24}
|
||||||
|
className="invert dark:invert-0"
|
||||||
|
/>
|
||||||
<span className="font-bold text-lg">OpenCut</span>
|
<span className="font-bold text-lg">OpenCut</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm md:text-left text-muted-foreground mb-5">
|
<p className="text-sm md:text-left text-muted-foreground mb-5">
|
||||||
|
|||||||
Reference in New Issue
Block a user