import { useEffect } from "react";

export default function useNotices({
  taskNotice,
  setTaskNotice,
  settingsNotice,
  setSettingsNotice,
  tdataNotice,
  setTdataNotice,
  showNotification
}) {
  useEffect(() => {
    if (!taskNotice) return;
    showNotification(taskNotice.text, taskNotice.tone || "info");
    setTaskNotice(null);
  }, [taskNotice]);

  useEffect(() => {
    if (!settingsNotice) return;
    showNotification(settingsNotice.text, settingsNotice.tone || "info");
    setSettingsNotice(null);
  }, [settingsNotice]);

  useEffect(() => {
    if (!tdataNotice) return;
    showNotification(tdataNotice.text, tdataNotice.tone || "info");
    setTdataNotice(null);
  }, [tdataNotice]);
}
