import { jsx as _jsx } from "react/jsx-runtime";
import { LayoutGrid, TableProperties } from 'lucide-react';
import { useState } from 'react';
import { Button } from '@vertesia/ui/core';
const LAST_DISPLAYED_VIEW = 'vertesia.content_store.lastDisplayedView';
export function ContentDispositionButton({ onUpdate }) {
    const [isGridView, setIsGridView] = useState(localStorage.getItem(LAST_DISPLAYED_VIEW) === "grid");
    const updateView = () => {
        if (isGridView) {
            toggleTableView();
        }
        else {
            toggleGridView();
        }
    };
    const toggleGridView = () => {
        localStorage.setItem(LAST_DISPLAYED_VIEW, "grid");
        setIsGridView(true);
        onUpdate(true);
    };
    const toggleTableView = () => {
        localStorage.setItem(LAST_DISPLAYED_VIEW, "table");
        setIsGridView(false);
        onUpdate(false);
    };
    return (_jsx(Button, { variant: "outline", onClick: updateView, alt: isGridView ? "Table View" : "Thumbnail View", children: isGridView
            ? _jsx(TableProperties, {})
            : _jsx(LayoutGrid, {}) }));
}
ContentDispositionButton.LAST_DISPLAYED_VIEW = LAST_DISPLAYED_VIEW;
//# sourceMappingURL=ContentDispositionButton.js.map