mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Grid/List View Pagination Fix
This commit is contained in:
parent
a1a5e5e299
commit
809bf19eb4
@ -116,21 +116,19 @@ export default function Dashboard() {
|
||||
|
||||
const [currentPage, setCurrentPage] = useState<number>(1);
|
||||
const [maxPage, setMaxPage] = useState<number>(1);
|
||||
const [itemsPerPage, setItemsPerPage] = useState<number>(5);
|
||||
const [applications, setApplications] = useState<Application[]>([]);
|
||||
const [servers, setServers] = useState<Server[]>([]);
|
||||
const [isGridLayout, setIsGridLayout] = useState<boolean>(false);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState<string>("");
|
||||
const [isSearching, setIsSearching] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
const savedLayout = Cookies.get("layoutPreference-app");
|
||||
const layout_bool = savedLayout === "grid";
|
||||
setIsGridLayout(layout_bool);
|
||||
setItemsPerPage(layout_bool ? 15 : 5);
|
||||
}, []);
|
||||
const savedLayout = Cookies.get("layoutPreference-app");
|
||||
const initialIsGridLayout = savedLayout === "grid";
|
||||
const initialItemsPerPage = initialIsGridLayout ? 15 : 5;
|
||||
|
||||
const [isGridLayout, setIsGridLayout] = useState<boolean>(initialIsGridLayout);
|
||||
const [itemsPerPage, setItemsPerPage] = useState<number>(initialItemsPerPage);
|
||||
|
||||
const toggleLayout = () => {
|
||||
const newLayout = !isGridLayout;
|
||||
|
||||
@ -116,9 +116,7 @@ export default function Dashboard() {
|
||||
|
||||
const [currentPage, setCurrentPage] = useState<number>(1)
|
||||
const [maxPage, setMaxPage] = useState<number>(1)
|
||||
const [itemsPerPage, setItemsPerPage] = useState<number>(4)
|
||||
const [servers, setServers] = useState<Server[]>([])
|
||||
const [isGridLayout, setIsGridLayout] = useState<boolean>(false)
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
|
||||
const [editId, setEditId] = useState<number | null>(null)
|
||||
@ -144,23 +142,23 @@ export default function Dashboard() {
|
||||
|
||||
const [monitoringInterval, setMonitoringInterval] = useState<NodeJS.Timeout | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const savedLayout = Cookies.get("layoutPreference-servers")
|
||||
const layout_bool = savedLayout === "grid"
|
||||
setIsGridLayout(layout_bool)
|
||||
setItemsPerPage(layout_bool ? 6 : 4)
|
||||
}, [])
|
||||
const savedLayout = Cookies.get("layoutPreference-servers");
|
||||
const initialIsGridLayout = savedLayout === "grid";
|
||||
const initialItemsPerPage = initialIsGridLayout ? 6 : 4;
|
||||
|
||||
const [isGridLayout, setIsGridLayout] = useState<boolean>(initialIsGridLayout);
|
||||
const [itemsPerPage, setItemsPerPage] = useState<number>(initialItemsPerPage);
|
||||
|
||||
const toggleLayout = () => {
|
||||
const newLayout = !isGridLayout
|
||||
setIsGridLayout(newLayout)
|
||||
const newLayout = !isGridLayout;
|
||||
setIsGridLayout(newLayout);
|
||||
Cookies.set("layoutPreference-servers", newLayout ? "grid" : "standard", {
|
||||
expires: 365,
|
||||
path: "/",
|
||||
sameSite: "strict",
|
||||
})
|
||||
setItemsPerPage(newLayout ? 6 : 4)
|
||||
}
|
||||
});
|
||||
setItemsPerPage(newLayout ? 6 : 4); // Update itemsPerPage based on new layout
|
||||
};
|
||||
|
||||
const add = async () => {
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user