Skip to content

Commit

Permalink
fix: message rule card title spacing on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
virtual-designer committed Oct 14, 2023
1 parent 64a790c commit 4078e45
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/components/MessageRuleManagement/MessageRuleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/*
* This file is part of SudoBot Dashboard.
*
* Copyright (C) 2021-2023 OSN Developers.
*
* SudoBot Dashboard is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SudoBot Dashboard is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with SudoBot Dashboard. If not, see <https://www.gnu.org/licenses/>.
*/
* This file is part of SudoBot Dashboard.
*
* Copyright (C) 2021-2023 OSN Developers.
*
* SudoBot Dashboard is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SudoBot Dashboard is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with SudoBot Dashboard. If not, see <https://www.gnu.org/licenses/>.
*/

import useIsDesktop from "@/hooks/useIsDesktop";
import { SettingCardProps } from "@/types/SetttingCardProps";
import { Button } from "@mui/material";
import { Card, CardBody, CardHeader } from "@nextui-org/react";
Expand All @@ -33,6 +34,7 @@ const MessageRuleCard: FC<SettingCardProps> = ({
const [state, setState] = useState(() => ({
enabled: !!config?.message_rules?.enabled,
}));
const isDesktop = useIsDesktop();

return (
<Card>
Expand All @@ -42,12 +44,12 @@ const MessageRuleCard: FC<SettingCardProps> = ({
<h4 className="font-bold text-large pl-2">
Message Rules
</h4>
<h4 className="font-bold bg-[#007bff] py-1 px-3 rounded-lg">
<h4 className="font-bold text-[10px] bg-[#007bff] py-1 px-3 rounded-lg">
BETA
</h4>
</div>
<div className="flex items-center gap-3">
{state.enabled && (
{state.enabled && isDesktop && (
<Button startIcon={<MdAdd />}>Create</Button>
)}
<Switch
Expand All @@ -71,6 +73,12 @@ const MessageRuleCard: FC<SettingCardProps> = ({
</p>

<MessageRules rules={config?.message_rules?.rules ?? []} />

<div className="flex items-center justify-end mt-3">
{state.enabled && !isDesktop && (
<Button startIcon={<MdAdd />}>Create</Button>
)}
</div>
</CardBody>
</Card>
);
Expand Down

0 comments on commit 4078e45

Please sign in to comment.