import { notification, message } from "antd";
import { Action } from "../../types";
import { merge } from "lodash";
import { json } from "overmind";

// import { ArgsProps } from "antd/lib/notification";

const showNotification: Action<{ message: string; duration?: number }> = (
	{ effects },
	{ message, duration }
) => {
	effects.ux.message.info(message, duration);
};

const setLayout: Action<{ headerShown?: boolean, walletShown?: boolean }> = ({ state }, props) => {
	// headerShown ?? (state.ux.layout.headerShown = headerShown);
	state.ux.layout = merge(json(state.ux.layout), props)
	// state.ux.layout.walletShown = walletShown;
}


export default {
	actions: {
		showNotification,
		setLayout
	},
	effects: {
		notification,
		message,
	},
	state: {
		layout: {
			headerShown: true,
			walletShown: true
		}
	}
};
