mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
refactor(dashboard): reorganiza widgets e remove magnet-lines
This commit is contained in:
28
lib/dashboard/use-payment-overview-widget-controller.ts
Normal file
28
lib/dashboard/use-payment-overview-widget-controller.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import {
|
||||
DEFAULT_PAYMENT_OVERVIEW_TAB,
|
||||
type PaymentOverviewTab,
|
||||
parsePaymentOverviewTab,
|
||||
} from "@/lib/dashboard/payment-overview-tabs";
|
||||
|
||||
export type PaymentOverviewWidgetController = {
|
||||
activeTab: PaymentOverviewTab;
|
||||
handleTabChange: (value: string) => void;
|
||||
};
|
||||
|
||||
export function usePaymentOverviewWidgetController(): PaymentOverviewWidgetController {
|
||||
const [activeTab, setActiveTab] = useState<PaymentOverviewTab>(
|
||||
DEFAULT_PAYMENT_OVERVIEW_TAB,
|
||||
);
|
||||
|
||||
const handleTabChange = (value: string) => {
|
||||
setActiveTab(parsePaymentOverviewTab(value));
|
||||
};
|
||||
|
||||
return {
|
||||
activeTab,
|
||||
handleTabChange,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user