feat: add mobile visibility toggle for sidebar apps and update related components
This commit is contained in:
@@ -18,6 +18,7 @@ interface SidebarAppFormData {
|
||||
url: string;
|
||||
icon: string;
|
||||
openMode: "tab" | "inline";
|
||||
showOnMobile: boolean;
|
||||
}
|
||||
|
||||
function AppForm({
|
||||
@@ -37,6 +38,7 @@ function AppForm({
|
||||
url: app?.url || "",
|
||||
icon: app?.icon || "Globe",
|
||||
openMode: app?.openMode || "tab",
|
||||
showOnMobile: app?.showOnMobile ?? false,
|
||||
});
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
|
||||
@@ -144,6 +146,25 @@ function AppForm({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<label className="text-sm font-medium">{t("show_on_mobile")}</label>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setFormData({ ...formData, showOnMobile: !formData.showOnMobile })}
|
||||
className={cn(
|
||||
"relative inline-flex h-5 w-9 items-center rounded-full transition-colors",
|
||||
formData.showOnMobile ? "bg-primary" : "bg-muted-foreground/30"
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
"inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",
|
||||
formData.showOnMobile ? "translate-x-4.5" : "translate-x-0.5"
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 justify-end">
|
||||
<Button type="button" variant="ghost" size="sm" onClick={onCancel}>
|
||||
{t("cancel")}
|
||||
|
||||
Reference in New Issue
Block a user