Compare commits
No commits in common. "current" and "jude/remove-activity-setter" have entirely different histories.
current
...
jude/remov
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2645,9 +2645,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rocket_dyn_templates"
|
||||
version = "0.2.0"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bbab919c9e67df3f7ac6624a32ef897df4cd61c0969f4d66f3ced0534660d7a"
|
||||
checksum = "04bfc006e547e4f72b760ab861f5943b688aed8a82c4977b5500c98f5d17dbfa"
|
||||
dependencies = [
|
||||
"normpath",
|
||||
"notify",
|
||||
|
|
|
@ -30,7 +30,7 @@ secrecy = "0.8.0"
|
|||
futures = "0.3.30"
|
||||
prometheus = "0.13.3"
|
||||
rocket = { version = "0.5.0", features = ["tls", "secrets", "json"] }
|
||||
rocket_dyn_templates = { version = "0.2.0", features = ["tera"] }
|
||||
rocket_dyn_templates = { version = "0.1.0", features = ["tera"] }
|
||||
serenity = { version = "0.12", default-features = false, features = ["builder", "cache", "client", "gateway", "http", "model", "utils", "rustls_backend"] }
|
||||
oauth2 = "4"
|
||||
csv = "1.2"
|
||||
|
|
|
@ -136,9 +136,9 @@ CREATE TABLE reminders (
|
|||
set_by INT UNSIGNED,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT `reminder_message_fk` FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE RESTRICT,
|
||||
CONSTRAINT `reminder_channel_fk` FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE,
|
||||
CONSTRAINT `reminder_user_fk` FOREIGN KEY (set_by) REFERENCES users(id) ON DELETE SET NULL
|
||||
FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE RESTRICT,
|
||||
FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (set_by) REFERENCES users(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TRIGGER message_cleanup AFTER DELETE ON reminders
|
||||
|
@ -157,9 +157,9 @@ CREATE TABLE todos (
|
|||
value VARCHAR(2000) NOT NULL,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT todos_ibfk_5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL,
|
||||
CONSTRAINT todos_ibfk_4 FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE,
|
||||
CONSTRAINT todos_ibfk_3 FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE SET NULL
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL,
|
||||
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TABLE command_restrictions (
|
||||
|
|
|
@ -46,7 +46,7 @@ CREATE TABLE reminders_new (
|
|||
PRIMARY KEY (id),
|
||||
|
||||
FOREIGN KEY (`channel_id`) REFERENCES channels (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `reminders_ibfk_2` FOREIGN KEY (`set_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
|
||||
FOREIGN KEY (`set_by`) REFERENCES users (`id`) ON DELETE SET NULL
|
||||
|
||||
# disallow having a reminder as restartable if it has no interval
|
||||
-- , CONSTRAINT restartable_interval_mutex CHECK (`restartable` = 0 OR `interval` IS NULL)
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- Tables no longer needed as old dashboard is decomm.
|
||||
DROP TABLE guild_users;
|
||||
DROP TABLE events;
|
||||
|
||||
ALTER TABLE users ADD COLUMN `reset_inputs_on_create` BOOLEAN NOT NULL DEFAULT 0;
|
||||
ALTER TABLE users ADD COLUMN `use_browser_timezone` BOOLEAN NOT NULL DEFAULT 1;
|
||||
ALTER TABLE users ADD COLUMN `dashboard_color_scheme` ENUM('system', 'light', 'dark') NOT NULL DEFAULT 'system';
|
||||
|
||||
ALTER TABLE users DROP COLUMN `language`;
|
||||
ALTER TABLE users DROP COLUMN `patreon`;
|
||||
ALTER TABLE users DROP COLUMN `name`;
|
||||
|
||||
ALTER TABLE todos DROP CONSTRAINT todos_ibfk_5, MODIFY COLUMN user_id BIGINT UNSIGNED;
|
||||
UPDATE todos SET user_id = (SELECT user FROM users WHERE id = user_id);
|
||||
ALTER TABLE todos ADD CONSTRAINT todos_user_fk FOREIGN KEY (user_id) REFERENCES users(user);
|
||||
|
||||
ALTER TABLE reminders DROP CONSTRAINT reminders_ibfk_2, MODIFY COLUMN set_by BIGINT UNSIGNED;
|
||||
UPDATE reminders SET set_by = (SELECT user FROM users WHERE id = set_by);
|
||||
ALTER TABLE reminders ADD CONSTRAINT reminder_user_fk FOREIGN KEY (set_by) REFERENCES users(user);
|
||||
|
||||
ALTER TABLE users DROP PRIMARY KEY, CHANGE id id INT UNSIGNED, ADD PRIMARY KEY (`user`);
|
||||
ALTER TABLE users DROP COLUMN `id`;
|
||||
ALTER TABLE users RENAME COLUMN `user` TO `id`;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
|
@ -22,6 +22,7 @@
|
|||
<title>Reminder Bot | Dashboard</title>
|
||||
|
||||
<!-- styles -->
|
||||
<link rel="stylesheet" href="/static/css/bulma.min.css">
|
||||
<link rel="stylesheet" href="/static/css/fa.css">
|
||||
<link rel="stylesheet" href="/static/css/font.css">
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
|
|
|
@ -1,27 +1,9 @@
|
|||
import axios from "axios";
|
||||
|
||||
enum ColorScheme {
|
||||
System = "system",
|
||||
Dark = "dark",
|
||||
Light = "light",
|
||||
}
|
||||
|
||||
type UserInfo = {
|
||||
name: string;
|
||||
patreon: boolean;
|
||||
preferences: {
|
||||
timezone: string | null;
|
||||
reset_inputs_on_create: boolean;
|
||||
dashboard_color_scheme: ColorScheme;
|
||||
use_browser_timezone: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export type UpdateUserInfo = {
|
||||
timezone?: string;
|
||||
reset_inputs_on_create?: boolean;
|
||||
dashboard_color_scheme?: ColorScheme;
|
||||
use_browser_timezone?: boolean;
|
||||
timezone: string | null;
|
||||
};
|
||||
|
||||
export type GuildInfo = {
|
||||
|
@ -127,7 +109,7 @@ export const fetchUserInfo = () => ({
|
|||
});
|
||||
|
||||
export const patchUserInfo = () => ({
|
||||
mutationFn: (userInfo: UpdateUserInfo) => axios.patch(`/dashboard/api/user`, userInfo),
|
||||
mutationFn: (timezone: string) => axios.patch(`/dashboard/api/user`, { timezone }),
|
||||
});
|
||||
|
||||
export const fetchUserGuilds = () => ({
|
||||
|
|
|
@ -1,27 +1,15 @@
|
|||
import { createContext } from "preact";
|
||||
import { useContext } from "preact/compat";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { useState } from "preact/hooks";
|
||||
import { DateTime } from "luxon";
|
||||
import { fetchUserInfo } from "../../api";
|
||||
import { useQuery } from "react-query";
|
||||
|
||||
type TTimezoneContext = [string, (tz: string) => void];
|
||||
|
||||
const TimezoneContext = createContext(["UTC", () => {}] as TTimezoneContext);
|
||||
|
||||
export const TimezoneProvider = ({ children }) => {
|
||||
const { data } = useQuery({ ...fetchUserInfo() });
|
||||
|
||||
const [timezone, setTimezone] = useState(DateTime.now().zoneName);
|
||||
|
||||
useEffect(() => {
|
||||
setTimezone(
|
||||
data === undefined || data.preferences.use_browser_timezone
|
||||
? DateTime.now().zoneName
|
||||
: data.preferences.timezone,
|
||||
);
|
||||
}, [data]);
|
||||
|
||||
return (
|
||||
<TimezoneContext.Provider value={[timezone, setTimezone]}>
|
||||
{children}
|
||||
|
|
|
@ -12,17 +12,12 @@ import { GuildTodos } from "../Guild/GuildTodos";
|
|||
export function App() {
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
let scheme = "light";
|
||||
// if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||
// scheme = "dark";
|
||||
// }
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<TimezoneProvider>
|
||||
<FlashProvider>
|
||||
<TimezoneProvider>
|
||||
<FlashProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Router base={"/dashboard"}>
|
||||
<div class={`columns is-gapless dashboard-frame scheme-${scheme}`}>
|
||||
<div class="columns is-gapless dashboard-frame">
|
||||
<Sidebar />
|
||||
<div class="column is-main-content">
|
||||
<div style={{ margin: "0 12px 12px 12px" }}>
|
||||
|
@ -52,8 +47,8 @@ export function App() {
|
|||
</div>
|
||||
</div>
|
||||
</Router>
|
||||
</FlashProvider>
|
||||
</TimezoneProvider>
|
||||
</QueryClientProvider>
|
||||
</QueryClientProvider>
|
||||
</FlashProvider>
|
||||
</TimezoneProvider>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,28 +1,21 @@
|
|||
import { LoadTemplate } from "../LoadTemplate";
|
||||
import { useReminder } from "../ReminderContext";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import {
|
||||
fetchUserInfo,
|
||||
postGuildReminder,
|
||||
postGuildTemplate,
|
||||
postUserReminder,
|
||||
} from "../../../api";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { postGuildReminder, postGuildTemplate, postUserReminder } from "../../../api";
|
||||
import { useState } from "preact/hooks";
|
||||
import { ICON_FLASH_TIME } from "../../../consts";
|
||||
import { useFlash } from "../../App/FlashContext";
|
||||
import { useGuild } from "../../App/useGuild";
|
||||
import { defaultReminder } from "../CreateReminder";
|
||||
|
||||
export const CreateButtonRow = () => {
|
||||
const guild = useGuild();
|
||||
const [reminder, setReminder] = useReminder();
|
||||
const [reminder] = useReminder();
|
||||
|
||||
const [recentlyCreated, setRecentlyCreated] = useState(false);
|
||||
const [templateRecentlyCreated, setTemplateRecentlyCreated] = useState(false);
|
||||
|
||||
const flash = useFlash();
|
||||
const queryClient = useQueryClient();
|
||||
const { data: userInfo } = useQuery({ ...fetchUserInfo() });
|
||||
const mutation = useMutation({
|
||||
...(guild ? postGuildReminder(guild) : postUserReminder()),
|
||||
onError: (error) => {
|
||||
|
@ -51,9 +44,6 @@ export const CreateButtonRow = () => {
|
|||
queryKey: ["USER_REMINDERS"],
|
||||
});
|
||||
}
|
||||
if (userInfo.preferences.reset_inputs_on_create) {
|
||||
setReminder(() => defaultReminder());
|
||||
}
|
||||
setRecentlyCreated(true);
|
||||
setTimeout(() => {
|
||||
setRecentlyCreated(false);
|
||||
|
|
|
@ -12,6 +12,7 @@ export const EditButtonRow = () => {
|
|||
const [reminder, setReminder] = useReminder();
|
||||
|
||||
const [recentlySaved, setRecentlySaved] = useState(false);
|
||||
|
||||
const iconFlashTimeout = useRef(0);
|
||||
|
||||
const flash = useFlash();
|
||||
|
|
|
@ -11,7 +11,7 @@ import "./styles.scss";
|
|||
import { useGuild } from "../App/useGuild";
|
||||
import { DEFAULT_COLOR } from "./Embed";
|
||||
|
||||
export function defaultReminder(): Reminder {
|
||||
function defaultReminder(): Reminder {
|
||||
return {
|
||||
attachment: null,
|
||||
attachment_name: null,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ChannelSelector } from "./ChannelSelector";
|
|||
import { DateTime } from "luxon";
|
||||
import { IntervalSelector } from "./IntervalSelector";
|
||||
import { useQuery } from "react-query";
|
||||
import { fetchGuildInfo, fetchUserInfo } from "../../api";
|
||||
import { fetchUserInfo } from "../../api";
|
||||
import { useReminder } from "./ReminderContext";
|
||||
import { Attachment } from "./Attachment";
|
||||
import { TTS } from "./TTS";
|
||||
|
@ -11,12 +11,11 @@ import { useGuild } from "../App/useGuild";
|
|||
|
||||
export const Settings = () => {
|
||||
const guild = useGuild();
|
||||
const { isSuccess: userFetched, data: userInfo } = useQuery({ ...fetchUserInfo() });
|
||||
const { isSuccess: guildFetched, data: guildInfo } = useQuery({ ...fetchGuildInfo(guild) });
|
||||
const { isSuccess: userFetched, data: userInfo } = useQuery(fetchUserInfo());
|
||||
|
||||
const [reminder, setReminder] = useReminder();
|
||||
|
||||
if (!userFetched || !guildFetched) {
|
||||
if (!userFetched) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
|
@ -60,13 +59,7 @@ export const Settings = () => {
|
|||
|
||||
<div class="collapses split-controls">
|
||||
<div>
|
||||
<div
|
||||
class={
|
||||
userInfo.patreon || guildInfo.patreon
|
||||
? "patreon-only"
|
||||
: "patreon-only is-locked"
|
||||
}
|
||||
>
|
||||
<div class={userInfo.patreon ? "patreon-only" : "patreon-only is-locked"}>
|
||||
<div class="patreon-invert foreground">
|
||||
Intervals available on <a href="https://patreon.com/jellywx">Patreon</a>{" "}
|
||||
or{" "}
|
||||
|
|
|
@ -26,11 +26,3 @@
|
|||
textarea.autoresize {
|
||||
resize: vertical !important;
|
||||
}
|
||||
|
||||
div.reminderContent {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 14px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import { fetchUserGuilds, fetchUserInfo, GuildInfo } from "../../api";
|
|||
import { TimezonePicker } from "../TimezonePicker";
|
||||
import "./styles.scss";
|
||||
import { Link, useLocation } from "wouter";
|
||||
import { UserPreferences } from "../UserPreferences";
|
||||
|
||||
type ContentProps = {
|
||||
guilds: GuildInfo[];
|
||||
|
@ -25,7 +24,7 @@ const SidebarContent = ({ guilds }: ContentProps) => {
|
|||
<Brand />
|
||||
</a>
|
||||
<Wave />
|
||||
<aside class="menu theme-dark">
|
||||
<aside class="menu">
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<Link
|
||||
|
@ -45,6 +44,7 @@ const SidebarContent = ({ guilds }: ContentProps) => {
|
|||
style={{
|
||||
position: "sticky",
|
||||
bottom: "0px",
|
||||
backgroundColor: "rgb(54, 54, 54)",
|
||||
}}
|
||||
>
|
||||
<p class="menu-label">Options</p>
|
||||
|
@ -52,7 +52,6 @@ const SidebarContent = ({ guilds }: ContentProps) => {
|
|||
<li>
|
||||
<div id="bottom-sidebar"></div>
|
||||
<TimezonePicker />
|
||||
<UserPreferences />
|
||||
<a href="/login/discord/logout">
|
||||
<span class="icon">
|
||||
<i class="fas fa-sign-out"></i>
|
||||
|
|
|
@ -39,7 +39,7 @@ aside.menu {
|
|||
}
|
||||
|
||||
.dashboard-sidebar {
|
||||
display: flex !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #363636;
|
||||
width: 230px !important;
|
||||
|
@ -49,19 +49,3 @@ aside.menu {
|
|||
.aside-footer {
|
||||
justify-self: end;
|
||||
}
|
||||
|
||||
.menu a {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.menu a:hover:not(.is-active) {
|
||||
color: #424242 !important;
|
||||
}
|
||||
|
||||
.menu .menu-label {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.menu {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ export const TimezonePicker = () => {
|
|||
|
||||
const TimezoneModal = ({ setModalOpen }) => {
|
||||
const browserTimezone = DateTime.now().zoneName;
|
||||
const [selectedZone, setTimezone] = useTimezone();
|
||||
const [selectedZone] = useTimezone();
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
const { isLoading, isError, data } = useQuery({ ...fetchUserInfo() });
|
||||
const { isLoading, isError, data } = useQuery(fetchUserInfo());
|
||||
const userInfoMutation = useMutation({
|
||||
...patchUserInfo(),
|
||||
onSuccess: () => {
|
||||
|
@ -79,7 +79,7 @@ const TimezoneModal = ({ setModalOpen }) => {
|
|||
{isLoading ? (
|
||||
<i className="fas fa-cog fa-spin"></i>
|
||||
) : (
|
||||
<TimezoneDisplay timezone={data.preferences.timezone || "UTC"} />
|
||||
<TimezoneDisplay timezone={data.timezone || "UTC"}></TimezoneDisplay>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
@ -93,29 +93,10 @@ const TimezoneModal = ({ setModalOpen }) => {
|
|||
margin: "2px",
|
||||
}}
|
||||
onClick={() => {
|
||||
userInfoMutation.mutate({ timezone: browserTimezone });
|
||||
userInfoMutation.mutate(browserTimezone);
|
||||
}}
|
||||
>
|
||||
Set bot timezone
|
||||
</button>
|
||||
<button
|
||||
class="button is-success is-outlined"
|
||||
id="update-bot-timezone"
|
||||
style={{
|
||||
margin: "2px",
|
||||
}}
|
||||
onClick={() => {
|
||||
userInfoMutation.mutate({
|
||||
use_browser_timezone: !data.preferences.use_browser_timezone,
|
||||
});
|
||||
setTimezone(
|
||||
data.preferences.use_browser_timezone
|
||||
? data.preferences.timezone
|
||||
: DateTime.now().zoneName,
|
||||
);
|
||||
}}
|
||||
>
|
||||
Use {data.preferences.use_browser_timezone ? "bot" : "browser"} timezone
|
||||
Set Bot Timezone
|
||||
</button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
import { Modal } from "../Modal";
|
||||
import { fetchUserInfo, patchUserInfo, UpdateUserInfo } from "../../api";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { useRef, useState } from "preact/hooks";
|
||||
import { ICON_FLASH_TIME } from "../../consts";
|
||||
import { useFlash } from "../App/FlashContext";
|
||||
|
||||
export const UserPreferences = () => {
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<a
|
||||
role={"button"}
|
||||
onClick={() => {
|
||||
setModalOpen(true);
|
||||
}}
|
||||
>
|
||||
<span class="icon">
|
||||
<i class="fas fa-cog"></i>
|
||||
</span>{" "}
|
||||
Preferences
|
||||
</a>
|
||||
{modalOpen && <PreferencesModal setModalOpen={setModalOpen} />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const PreferencesModal = ({ setModalOpen }) => {
|
||||
const flash = useFlash();
|
||||
const queryClient = useQueryClient();
|
||||
const { isLoading, isSuccess, isError, data } = useQuery({ ...fetchUserInfo() });
|
||||
const userInfoMutation = useMutation({
|
||||
...patchUserInfo(),
|
||||
onError: (error) => {
|
||||
flash({
|
||||
message: `An error occurred: ${error}`,
|
||||
type: "error",
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
if (iconFlashTimeout.current !== null) {
|
||||
clearTimeout(iconFlashTimeout.current);
|
||||
}
|
||||
setRecentlySaved(true);
|
||||
iconFlashTimeout.current = setTimeout(() => {
|
||||
setRecentlySaved(false);
|
||||
}, ICON_FLASH_TIME);
|
||||
|
||||
queryClient.invalidateQueries(["USER_INFO"]).then(() => setUpdatedSettings({}));
|
||||
},
|
||||
});
|
||||
|
||||
const resetInputsRef = useRef(null as HTMLInputElement | null);
|
||||
|
||||
const [recentlySaved, setRecentlySaved] = useState(false);
|
||||
const iconFlashTimeout = useRef(0);
|
||||
|
||||
const [updatedSettings, setUpdatedSettings] = useState({} as UpdateUserInfo);
|
||||
|
||||
if (isError) {
|
||||
return (
|
||||
<Modal setModalOpen={setModalOpen} title={"Preferences"}>
|
||||
<span>An error occurred loading user preferences</span>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal title={"Preferences"} setModalOpen={setModalOpen}>
|
||||
<div style={{ display: "flex", flexDirection: "row", alignContent: "center" }}>
|
||||
<label>
|
||||
<div class={"is-inline-block"}>
|
||||
{isLoading && <i class={"fa fa-spinner"} />}
|
||||
{isSuccess && (
|
||||
<input
|
||||
type={"checkbox"}
|
||||
checked={
|
||||
updatedSettings.reset_inputs_on_create === undefined
|
||||
? data.preferences.reset_inputs_on_create
|
||||
: updatedSettings.reset_inputs_on_create
|
||||
}
|
||||
ref={resetInputsRef}
|
||||
onInput={() =>
|
||||
setUpdatedSettings((s) => ({
|
||||
...s,
|
||||
reset_inputs_on_create: resetInputsRef.current.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div class={"is-inline-block"} style={{ marginLeft: "6px" }}>
|
||||
Reset reminder inputs when creating a reminder
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<br></br>
|
||||
<div class="has-text-centered">
|
||||
<button
|
||||
class="button is-success is-outlined"
|
||||
style={{
|
||||
margin: "2px",
|
||||
}}
|
||||
onClick={() => {
|
||||
userInfoMutation.mutate({ ...updatedSettings });
|
||||
}}
|
||||
disabled={userInfoMutation.isLoading}
|
||||
>
|
||||
<span>Save</span>
|
||||
{userInfoMutation.isLoading ? (
|
||||
<span class="icon">
|
||||
<i class="fas fa-spin fa-cog"></i>
|
||||
</span>
|
||||
) : recentlySaved ? (
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
) : (
|
||||
<span class="icon">
|
||||
<i class="fas fa-save"></i>
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
};
|
|
@ -1,5 +1,3 @@
|
|||
@import "node_modules/bulma/bulma";
|
||||
|
||||
/* override styles for when the div is collapsed */
|
||||
div.reminderContent.is-collapsed .column.discord-frame {
|
||||
display: none;
|
||||
|
@ -49,11 +47,3 @@ div.reminderContent.is-collapsed .hide-box {
|
|||
div.reminderContent.is-collapsed .hide-box i {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.button.is-success:not(.is-outlined) {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.button.is-outlined.is-success:not(.is-focused, :hover, :focus) {
|
||||
background-color: white;
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
$primary-background-light: #ffffff;
|
||||
$secondary-background-light: #f5f5f5;
|
||||
$contrast-background-light: #363636;
|
||||
$primary-text-light: #4a4a4a;
|
||||
$secondary-text-light: #4a4a4a;
|
||||
$contrast-text-light: #ffffff;
|
||||
|
||||
$primary-background-dark: #363636;
|
||||
$secondary-background-dark: #424242;
|
||||
$contrast-background-dark: #242424;
|
||||
$primary-text-dark: #ffffff;
|
||||
$secondary-text-dark: #ffffff;
|
||||
$contrast-text-dark: #ffffff;
|
|
@ -17,7 +17,10 @@ impl Recordable for Options {
|
|||
sqlx::query!(
|
||||
"
|
||||
INSERT INTO todos (user_id, value)
|
||||
VALUES (?, ?)
|
||||
VALUES (
|
||||
(SELECT id FROM users WHERE user = ?),
|
||||
?
|
||||
)
|
||||
",
|
||||
ctx.author().id.get(),
|
||||
self.task
|
||||
|
|
|
@ -14,7 +14,8 @@ impl Recordable for Options {
|
|||
let values = sqlx::query!(
|
||||
"
|
||||
SELECT todos.id, value FROM todos
|
||||
WHERE user_id = ?
|
||||
INNER JOIN users ON todos.user_id = users.id
|
||||
WHERE users.user = ?
|
||||
",
|
||||
ctx.author().id.get(),
|
||||
)
|
||||
|
|
|
@ -191,7 +191,8 @@ impl ComponentDataModel {
|
|||
sqlx::query!(
|
||||
"
|
||||
SELECT todos.id, value FROM todos
|
||||
WHERE user_id = ?
|
||||
INNER JOIN users ON todos.user_id = users.id
|
||||
WHERE users.user = ?
|
||||
",
|
||||
uid,
|
||||
)
|
||||
|
@ -284,9 +285,10 @@ impl ComponentDataModel {
|
|||
let values = if let Some(uid) = selector.user_id {
|
||||
sqlx::query!(
|
||||
"
|
||||
SELECT todos.id, value FROM todos
|
||||
WHERE user_id = ?
|
||||
",
|
||||
SELECT todos.id, value FROM todos
|
||||
INNER JOIN users ON todos.user_id = users.id
|
||||
WHERE users.user = ?
|
||||
",
|
||||
uid,
|
||||
)
|
||||
.fetch_all(&data.database)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use poise::{
|
||||
serenity_prelude as serenity,
|
||||
serenity_prelude::{CreateEmbed, CreateMessage, FullEvent},
|
||||
serenity_prelude::{ActivityData, CreateEmbed, CreateMessage, FullEvent},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use poise::{CommandInteractionType, CreateReply};
|
||||
use poise::{serenity_prelude::model::channel::Channel, CommandInteractionType, CreateReply};
|
||||
|
||||
use crate::{consts::MACRO_MAX_COMMANDS, models::command_macro::RecordedCommand, Context, Error};
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ pub struct ReminderBuilder {
|
|||
tts: bool,
|
||||
attachment_name: Option<String>,
|
||||
attachment: Option<Vec<u8>>,
|
||||
set_by: Option<u64>,
|
||||
set_by: Option<u32>,
|
||||
}
|
||||
|
||||
impl ReminderBuilder {
|
||||
|
@ -132,7 +132,7 @@ pub struct MultiReminderBuilder<'a> {
|
|||
interval: Option<Interval>,
|
||||
expires: Option<NaiveDateTime>,
|
||||
content: Content,
|
||||
set_by: Option<u64>,
|
||||
set_by: Option<u32>,
|
||||
ctx: &'a Context<'a>,
|
||||
guild_id: Option<GuildId>,
|
||||
}
|
||||
|
|
|
@ -85,13 +85,17 @@ impl Reminder {
|
|||
reminders.enabled,
|
||||
reminders.content,
|
||||
reminders.embed_description,
|
||||
reminders.set_by
|
||||
users.user AS set_by
|
||||
FROM
|
||||
reminders
|
||||
INNER JOIN
|
||||
channels
|
||||
ON
|
||||
reminders.channel_id = channels.id
|
||||
LEFT JOIN
|
||||
users
|
||||
ON
|
||||
reminders.set_by = users.id
|
||||
WHERE
|
||||
reminders.uid = ?
|
||||
",
|
||||
|
@ -118,13 +122,17 @@ impl Reminder {
|
|||
reminders.enabled,
|
||||
reminders.content,
|
||||
reminders.embed_description,
|
||||
reminders.set_by
|
||||
users.user AS set_by
|
||||
FROM
|
||||
reminders
|
||||
INNER JOIN
|
||||
channels
|
||||
ON
|
||||
reminders.channel_id = channels.id
|
||||
LEFT JOIN
|
||||
users
|
||||
ON
|
||||
reminders.set_by = users.id
|
||||
WHERE
|
||||
reminders.id = ?
|
||||
",
|
||||
|
@ -158,13 +166,17 @@ impl Reminder {
|
|||
reminders.enabled,
|
||||
reminders.content,
|
||||
reminders.embed_description,
|
||||
reminders.set_by
|
||||
users.user AS set_by
|
||||
FROM
|
||||
reminders
|
||||
INNER JOIN
|
||||
channels
|
||||
ON
|
||||
reminders.channel_id = channels.id
|
||||
LEFT JOIN
|
||||
users
|
||||
ON
|
||||
reminders.set_by = users.id
|
||||
WHERE
|
||||
`status` = 'pending' AND
|
||||
channels.channel = ? AND
|
||||
|
@ -218,13 +230,17 @@ impl Reminder {
|
|||
reminders.enabled,
|
||||
reminders.content,
|
||||
reminders.embed_description,
|
||||
reminders.set_by
|
||||
users.user AS set_by
|
||||
FROM
|
||||
reminders
|
||||
LEFT JOIN
|
||||
channels
|
||||
ON
|
||||
channels.id = reminders.channel_id
|
||||
LEFT JOIN
|
||||
users
|
||||
ON
|
||||
reminders.set_by = users.id
|
||||
WHERE
|
||||
`status` = 'pending' AND
|
||||
FIND_IN_SET(channels.channel, ?)
|
||||
|
@ -250,13 +266,17 @@ impl Reminder {
|
|||
reminders.enabled,
|
||||
reminders.content,
|
||||
reminders.embed_description,
|
||||
reminders.set_by
|
||||
users.user AS set_by
|
||||
FROM
|
||||
reminders
|
||||
LEFT JOIN
|
||||
channels
|
||||
ON
|
||||
channels.id = reminders.channel_id
|
||||
LEFT JOIN
|
||||
users
|
||||
ON
|
||||
reminders.set_by = users.id
|
||||
WHERE
|
||||
`status` = 'pending' AND
|
||||
channels.guild_id = (SELECT id FROM guilds WHERE guild = ?)
|
||||
|
@ -283,16 +303,20 @@ impl Reminder {
|
|||
reminders.enabled,
|
||||
reminders.content,
|
||||
reminders.embed_description,
|
||||
reminders.set_by
|
||||
users.user AS set_by
|
||||
FROM
|
||||
reminders
|
||||
INNER JOIN
|
||||
channels
|
||||
ON
|
||||
channels.id = reminders.channel_id
|
||||
LEFT JOIN
|
||||
users
|
||||
ON
|
||||
reminders.set_by = users.id
|
||||
WHERE
|
||||
`status` = 'pending' AND
|
||||
channels.id = (SELECT dm_channel FROM users WHERE id = ?)
|
||||
channels.id = (SELECT dm_channel FROM users WHERE user = ?)
|
||||
",
|
||||
user.get()
|
||||
)
|
||||
|
|
|
@ -6,7 +6,9 @@ use sqlx::MySqlPool;
|
|||
use crate::consts::LOCAL_TIMEZONE;
|
||||
|
||||
pub struct UserData {
|
||||
pub id: u64,
|
||||
pub id: u32,
|
||||
#[allow(dead_code)]
|
||||
pub user: u64,
|
||||
pub dm_channel: u32,
|
||||
pub timezone: String,
|
||||
pub allowed_dm: bool,
|
||||
|
@ -21,9 +23,7 @@ impl UserData {
|
|||
|
||||
match sqlx::query!(
|
||||
"
|
||||
SELECT IFNULL(timezone, 'UTC') AS timezone
|
||||
FROM users
|
||||
WHERE id = ?
|
||||
SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ?
|
||||
",
|
||||
user_id
|
||||
)
|
||||
|
@ -48,9 +48,7 @@ impl UserData {
|
|||
match sqlx::query_as_unchecked!(
|
||||
Self,
|
||||
"
|
||||
SELECT id, dm_channel, IF(timezone IS NULL, ?, timezone) AS timezone, allowed_dm
|
||||
FROM users
|
||||
WHERE id = ?
|
||||
SELECT id, user, dm_channel, IF(timezone IS NULL, ?, timezone) AS timezone, allowed_dm FROM users WHERE user = ?
|
||||
",
|
||||
*LOCAL_TIMEZONE,
|
||||
user_id.get()
|
||||
|
@ -66,8 +64,7 @@ impl UserData {
|
|||
|
||||
sqlx::query!(
|
||||
"
|
||||
INSERT IGNORE INTO channels (channel)
|
||||
VALUES (?)
|
||||
INSERT IGNORE INTO channels (channel) VALUES (?)
|
||||
",
|
||||
dm_channel.id.get()
|
||||
)
|
||||
|
@ -76,8 +73,7 @@ impl UserData {
|
|||
|
||||
sqlx::query!(
|
||||
"
|
||||
INSERT INTO users (id, dm_channel, timezone)
|
||||
VALUES (?, (SELECT id FROM channels WHERE channel = ?), ?)
|
||||
INSERT INTO users (name, user, dm_channel, timezone) VALUES ('', ?, (SELECT id FROM channels WHERE channel = ?), ?)
|
||||
",
|
||||
user_id.get(),
|
||||
dm_channel.id.get(),
|
||||
|
@ -89,9 +85,7 @@ impl UserData {
|
|||
Ok(sqlx::query_as_unchecked!(
|
||||
Self,
|
||||
"
|
||||
SELECT id, dm_channel, timezone, allowed_dm
|
||||
FROM users
|
||||
WHERE id = ?
|
||||
SELECT id, user, dm_channel, timezone, allowed_dm FROM users WHERE user = ?
|
||||
",
|
||||
user_id.get()
|
||||
)
|
||||
|
@ -110,9 +104,7 @@ impl UserData {
|
|||
pub async fn commit_changes(&self, pool: &MySqlPool) {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
SET timezone = ?, allowed_dm = ?
|
||||
WHERE id = ?
|
||||
UPDATE users SET timezone = ?, allowed_dm = ? WHERE id = ?
|
||||
",
|
||||
self.timezone,
|
||||
self.allowed_dm,
|
||||
|
|
|
@ -16,15 +16,17 @@ pub async fn get_guild_roles(id: u64, cookies: &CookieJar<'_>, ctx: &State<Conte
|
|||
offline!(Ok(json!(vec![RoleInfo { name: "@everyone".to_string(), id: "1".to_string() }])));
|
||||
check_authorization(cookies, ctx.inner(), id).await?;
|
||||
|
||||
let roles_res = ctx.cache.guild(id).map(|g| {
|
||||
g.roles
|
||||
.iter()
|
||||
.map(|(_, r)| RoleInfo { id: r.id.to_string(), name: r.name.to_string() })
|
||||
.collect::<Vec<RoleInfo>>()
|
||||
});
|
||||
let roles_res = ctx.cache.guild_roles(id);
|
||||
|
||||
match roles_res {
|
||||
Some(roles) => Ok(json!(roles)),
|
||||
Some(roles) => {
|
||||
let roles = roles
|
||||
.iter()
|
||||
.map(|(_, r)| RoleInfo { id: r.id.to_string(), name: r.name.to_string() })
|
||||
.collect::<Vec<RoleInfo>>();
|
||||
|
||||
Ok(json!(roles))
|
||||
}
|
||||
None => {
|
||||
warn!("Could not fetch roles from {}", id);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ use std::env;
|
|||
|
||||
use chrono_tz::Tz;
|
||||
pub use guilds::*;
|
||||
use log::warn;
|
||||
pub use reminders::*;
|
||||
use rocket::{
|
||||
get,
|
||||
|
@ -22,29 +21,16 @@ use serenity::{
|
|||
};
|
||||
use sqlx::{MySql, Pool};
|
||||
|
||||
use crate::web::guards::transaction::Transaction;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct UserPreferences {
|
||||
timezone: String,
|
||||
use_browser_timezone: bool,
|
||||
dashboard_color_scheme: String,
|
||||
reset_inputs_on_create: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct UserInfo {
|
||||
name: String,
|
||||
patreon: bool,
|
||||
preferences: UserPreferences,
|
||||
timezone: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UpdateUserPreferences {
|
||||
timezone: Option<String>,
|
||||
use_browser_timezone: Option<bool>,
|
||||
dashboard_color_scheme: Option<String>,
|
||||
reset_inputs_on_create: Option<bool>,
|
||||
pub struct UpdateUser {
|
||||
timezone: String,
|
||||
}
|
||||
|
||||
#[get("/api/user")]
|
||||
|
@ -53,16 +39,7 @@ pub async fn get_user_info(
|
|||
ctx: &State<Context>,
|
||||
pool: &State<Pool<MySql>>,
|
||||
) -> JsonValue {
|
||||
offline!(json!(UserInfo {
|
||||
name: "Discord".to_string(),
|
||||
patreon: true,
|
||||
preferences: UserPreferences {
|
||||
timezone: "UTC".to_string(),
|
||||
use_browser_timezone: true,
|
||||
dashboard_color_scheme: "system".to_string(),
|
||||
reset_inputs_on_create: false,
|
||||
}
|
||||
}));
|
||||
offline!(json!(UserInfo { name: "Discord".to_string(), patreon: true, timezone: None }));
|
||||
|
||||
if let Some(user_id) =
|
||||
cookies.get_private("userid").map(|u| u.value().parse::<u64>().ok()).flatten()
|
||||
|
@ -71,34 +48,13 @@ pub async fn get_user_info(
|
|||
.member(&ctx.inner(), user_id)
|
||||
.await;
|
||||
|
||||
let preferences = sqlx::query!(
|
||||
"
|
||||
SELECT
|
||||
IFNULL(timezone, 'UTC') AS timezone,
|
||||
use_browser_timezone,
|
||||
dashboard_color_scheme,
|
||||
reset_inputs_on_create
|
||||
FROM users
|
||||
WHERE id = ?
|
||||
",
|
||||
let timezone = sqlx::query!(
|
||||
"SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ?",
|
||||
user_id
|
||||
)
|
||||
.fetch_one(pool.inner())
|
||||
.await
|
||||
.map_or(
|
||||
UserPreferences {
|
||||
timezone: "UTC".to_string(),
|
||||
use_browser_timezone: false,
|
||||
dashboard_color_scheme: "system".to_string(),
|
||||
reset_inputs_on_create: false,
|
||||
},
|
||||
|q| UserPreferences {
|
||||
timezone: q.timezone,
|
||||
use_browser_timezone: q.use_browser_timezone != 0,
|
||||
dashboard_color_scheme: q.dashboard_color_scheme,
|
||||
reset_inputs_on_create: q.reset_inputs_on_create != 0,
|
||||
},
|
||||
);
|
||||
.map_or(None, |q| Some(q.timezone));
|
||||
|
||||
let user_info = UserInfo {
|
||||
name: cookies
|
||||
|
@ -109,7 +65,7 @@ pub async fn get_user_info(
|
|||
.roles
|
||||
.contains(&RoleId::new(env::var("PATREON_ROLE_ID").unwrap().parse().unwrap()))
|
||||
}),
|
||||
preferences,
|
||||
timezone,
|
||||
};
|
||||
|
||||
json!(user_info)
|
||||
|
@ -118,86 +74,27 @@ pub async fn get_user_info(
|
|||
}
|
||||
}
|
||||
|
||||
#[patch("/api/user", data = "<preferences>")]
|
||||
#[patch("/api/user", data = "<user>")]
|
||||
pub async fn update_user_info(
|
||||
cookies: &CookieJar<'_>,
|
||||
preferences: Json<UpdateUserPreferences>,
|
||||
mut transaction: Transaction<'_>,
|
||||
user: Json<UpdateUser>,
|
||||
pool: &State<Pool<MySql>>,
|
||||
) -> JsonValue {
|
||||
if let Some(user_id) =
|
||||
cookies.get_private("userid").map(|u| u.value().parse::<u64>().ok()).flatten()
|
||||
{
|
||||
if let Some(timezone) = &preferences.timezone {
|
||||
if timezone.parse::<Tz>().is_ok() {
|
||||
let _ = sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
SET timezone = ?
|
||||
WHERE id = ?
|
||||
",
|
||||
timezone,
|
||||
user_id,
|
||||
)
|
||||
.execute(transaction.executor())
|
||||
.await;
|
||||
} else {
|
||||
return json!({"error": "Timezone not recognised"});
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(dashboard_color_scheme) = &preferences.dashboard_color_scheme {
|
||||
if vec!["system", "light", "dark"].contains(&dashboard_color_scheme.as_str()) {
|
||||
let _ = sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
SET dashboard_color_scheme = ?
|
||||
WHERE id = ?
|
||||
",
|
||||
dashboard_color_scheme,
|
||||
user_id,
|
||||
)
|
||||
.execute(transaction.executor())
|
||||
.await;
|
||||
} else {
|
||||
return json!({"error": "Color scheme not recognised"});
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(reset_inputs_on_create) = &preferences.reset_inputs_on_create {
|
||||
if user.timezone.parse::<Tz>().is_ok() {
|
||||
let _ = sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
SET reset_inputs_on_create = ?
|
||||
WHERE id = ?
|
||||
",
|
||||
reset_inputs_on_create,
|
||||
"UPDATE users SET timezone = ? WHERE user = ?",
|
||||
user.timezone,
|
||||
user_id,
|
||||
)
|
||||
.execute(transaction.executor())
|
||||
.execute(pool.inner())
|
||||
.await;
|
||||
}
|
||||
|
||||
if let Some(use_browser_timezone) = &preferences.use_browser_timezone {
|
||||
let _ = sqlx::query!(
|
||||
"
|
||||
UPDATE users
|
||||
SET use_browser_timezone = ?
|
||||
WHERE id = ?
|
||||
",
|
||||
use_browser_timezone,
|
||||
user_id,
|
||||
)
|
||||
.execute(transaction.executor())
|
||||
.await;
|
||||
}
|
||||
|
||||
match transaction.commit().await {
|
||||
Ok(_) => json!({}),
|
||||
Err(e) => {
|
||||
warn!("Error updating user preferences for {}: {:?}", user_id, e);
|
||||
|
||||
json!({"error": "Couldn't update preferences"})
|
||||
}
|
||||
json!({})
|
||||
} else {
|
||||
json!({"error": "Timezone not recognized"})
|
||||
}
|
||||
} else {
|
||||
json!({"error": "Not authorized"})
|
||||
|
|
|
@ -593,11 +593,18 @@ pub(crate) async fn create_reminder(
|
|||
}
|
||||
|
||||
fn check_channel_matches_guild(ctx: &Context, channel_id: ChannelId, guild_id: GuildId) -> bool {
|
||||
return match ctx.cache.guild(guild_id) {
|
||||
Some(guild) => guild.channels.get(&channel_id).is_some(),
|
||||
// validate channel
|
||||
let channel = channel_id.to_channel_cached(&ctx.cache);
|
||||
let channel_exists = channel.is_some();
|
||||
|
||||
None => false,
|
||||
};
|
||||
if !channel_exists {
|
||||
return false;
|
||||
}
|
||||
|
||||
let channel_matches_guild =
|
||||
channel.map_or(false, |c| c.guild(&ctx.cache).map_or(false, |g| g.id == guild_id));
|
||||
|
||||
channel_matches_guild
|
||||
}
|
||||
|
||||
async fn create_database_channel(
|
||||
|
|
|
@ -100,6 +100,14 @@ div.split-controls {
|
|||
flex-basis: 50%;
|
||||
}
|
||||
|
||||
div.reminderContent {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 14px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.left-pad {
|
||||
padding-left: 1rem;
|
||||
padding-right: 0.2rem;
|
||||
|
@ -206,6 +214,18 @@ div.dashboard-frame {
|
|||
min-width: auto;
|
||||
}
|
||||
|
||||
.menu a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.menu .menu-label {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.menu {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.dashboard-navbar {
|
||||
background-color: #8fb677 !important;
|
||||
position: absolute;
|
||||
|
@ -660,6 +680,14 @@ div.reminderError .reminderMessage {
|
|||
margin: 0 12px 12px 12px;
|
||||
}
|
||||
|
||||
.button.is-success:not(.is-outlined) {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.button.is-outlined.is-success {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
a.switch-pane {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
@ -705,3 +733,27 @@ a.switch-pane.is-active ~ .guild-submenu {
|
|||
.is-locked .field:last-of-type {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.stat-box {
|
||||
flex-grow: 1;
|
||||
border-radius: 6px;
|
||||
background-color: #fcfcfc;
|
||||
border-color: #efefef;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
margin: 4px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.figure {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.figure-num {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
|
389
templates/dashboard.html.tera
Normal file
389
templates/dashboard.html.tera
Normal file
|
@ -0,0 +1,389 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="EN">
|
||||
<head>
|
||||
<script src="/static/js/reporter.js" type="application/javascript"></script>
|
||||
|
||||
<meta name="description" content="The most powerful Discord Reminders Bot">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="yandex-verification" content="bb77b8681eb64a90"/>
|
||||
<meta name="google-site-verification" content="7h7UVTeEe0AOzHiH3cFtsqMULYGN-zCZdMT_YCkW1Ho"/>
|
||||
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src *; font-src fonts.gstatic.com 'self'"> -->
|
||||
|
||||
<!-- favicon -->
|
||||
<link rel="apple-touch-icon" sizes="180x180"
|
||||
href="/static/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="/static/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="/static/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="/static/favicon/site.webmanifest">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<title>Reminder Bot | Dashboard</title>
|
||||
|
||||
<!-- styles -->
|
||||
<link rel="stylesheet" href="/static/css/bulma.min.css">
|
||||
<link rel="stylesheet" href="/static/css/fa.css">
|
||||
<link rel="stylesheet" href="/static/css/font.css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v{{ version }}">
|
||||
<link rel="stylesheet" href="/static/css/dtsel.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tributejs/5.1.3/tribute.css" integrity="sha512-GnwBnXd+ZGO9CdP343MUr0jCcJXCr++JVtQRnllexRW2IDq4Zvrh/McTQjooAKnSUbXZ7wamp7AQSweTnfMVoA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
|
||||
<script src="/static/js/luxon.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tributejs/5.1.3/tribute.min.js" integrity="sha512-KJYWC7RKz/Abtsu1QXd7VJ1IJua7P7GTpl3IKUqfa21Otg2opvRYmkui/CXBC6qeDYCNlQZ7c+7JfDXnKdILUA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar is-spaced is-size-4 is-hidden-desktop dashboard-navbar" role="navigation"
|
||||
aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="/">
|
||||
<figure class="image">
|
||||
<img width="28px" height="28px" src="/static/img/logo_nobg.webp" alt="Reminder Bot Logo">
|
||||
</figure>
|
||||
</a>
|
||||
|
||||
<p class="navbar-item pageTitle">
|
||||
</p>
|
||||
|
||||
<a role="button" class="dashboard-burger navbar-burger is-right" aria-label="menu" aria-expanded="false"
|
||||
data-target="mobileSidebar">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div id="loader" class="is-hidden hero is-fullheight">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<p class="title">
|
||||
<i class="fas fa-cog fa-spin"></i>
|
||||
</p>
|
||||
<p class="subtitle">
|
||||
<strong>Loading...</strong>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- dead image used to check which other images are dead -->
|
||||
<img src="" id="dead">
|
||||
|
||||
<div class="notification is-danger flash-message" id="errors">
|
||||
<span class="icon"><i class="far fa-exclamation-circle"></i></span> <span class="error-message"></span>
|
||||
</div>
|
||||
|
||||
<div class="notification is-success flash-message" id="success">
|
||||
<span class="icon"><i class="far fa-check"></i></span> <span class="success-message"></span>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="addImageModal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<label class="modal-card-title" for="urlInput">Enter Image URL</label>
|
||||
<button class="delete close-modal" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<input class="input" id="urlInput" placeholder="Image URL...">
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button is-success" id="setImgUrl">Save</button>
|
||||
<button class="button close-modal">Cancel</button>
|
||||
</footer>
|
||||
</div>
|
||||
<button class="modal-close is-large close-modal" aria-label="close"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="pickColorModal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<label class="modal-card-title" for="colorInput">Select Color</label>
|
||||
<button class="delete close-modal" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div class="colorpicker-container">
|
||||
<div id="colorpicker"></div>
|
||||
</div>
|
||||
<input class="input" id="colorInput">
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button is-success">Save</button>
|
||||
<button class="button close-modal">Cancel</button>
|
||||
</footer>
|
||||
</div>
|
||||
<button class="modal-close is-large close-modal" aria-label="close"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="chooseTimezoneModal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<label class="modal-card-title" for="urlInput">Update Timezone <a href="/help/timezone"><span><i class="fa fa-question-circle"></i></span></a></label>
|
||||
<button class="delete close-modal" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<p>
|
||||
Your configured timezone is: <strong><span class="set-timezone">%browsertimezone%</span></strong> (<span class="set-time">HH:mm</span>)
|
||||
<br>
|
||||
<br>
|
||||
Your browser timezone is: <strong><span class="browser-timezone">%browsertimezone%</span></strong> (<span class="browser-time">HH:mm</span>)
|
||||
<br>
|
||||
Your bot timezone is: <strong><span class="bot-timezone">%bottimezone%</span></strong> (<span class="bot-time">HH:mm</span>)
|
||||
</p>
|
||||
<br>
|
||||
<div class="has-text-centered">
|
||||
<button class="button is-success close-modal" id="set-browser-timezone">Use Browser Timezone</button>
|
||||
<button class="button is-link close-modal" id="set-bot-timezone">Use Bot Timezone</button>
|
||||
<button class="button is-warning close-modal" id="update-bot-timezone">Set Bot Timezone</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close is-large close-modal" aria-label="close"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="chooseTemplateModal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<label class="modal-card-title" for="urlInput">Load Template</label>
|
||||
<button class="delete close-modal" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div class="control has-icons-left">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="templateSelect">
|
||||
</select>
|
||||
</div>
|
||||
<div class="icon is-small is-left">
|
||||
<i class="fas fa-file-spreadsheet"></i>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="has-text-centered">
|
||||
<button class="button is-success close-modal" id="load-template">Load Template</button>
|
||||
<button class="button is-danger" id="delete-template">Delete</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close is-large close-modal" aria-label="close"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="dataManagerModal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<label class="modal-card-title" for="urlInput">Import/Export Manager <a href="/help/iemanager"><span><i class="fa fa-question-circle"></i></span></a></label>
|
||||
<button class="delete close-modal" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div class="control">
|
||||
<div class="field">
|
||||
<label>
|
||||
<input type="radio" class="default-width" name="exportSelect" value="reminders" checked>
|
||||
Reminders
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="has-text-centered">
|
||||
<div style="color: red">
|
||||
Please first read the <a href="/help/iemanager">support page</a>
|
||||
</div>
|
||||
<button class="button is-success is-outlined" id="import-data">Import Data</button>
|
||||
<button class="button is-success" id="export-data">Export Data</button>
|
||||
</div>
|
||||
<a id="downloader" download="export.csv" class="is-hidden"></a>
|
||||
<input id="uploader" type="file" hidden></input>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close is-large close-modal" aria-label="close"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="deleteReminderModal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<label class="modal-card-title">Delete Reminder</label>
|
||||
<button class="delete close-modal" aria-label="close"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<p>
|
||||
This reminder will be permanently deleted. Are you sure?
|
||||
</p>
|
||||
<br>
|
||||
<div class="has-text-centered">
|
||||
<button class="button is-danger" id="delete-reminder-confirm">Delete</button>
|
||||
<button class="button is-light close-modal">Cancel</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close is-large close-modal" aria-label="close"></button>
|
||||
</div>
|
||||
|
||||
<div class="columns is-gapless dashboard-frame">
|
||||
<div class="column is-2 is-sidebar-menu dashboard-sidebar is-hidden-touch">
|
||||
<a href="/">
|
||||
<div class="brand">
|
||||
<img src="/static/img/logo_nobg.webp" alt="Reminder bot logo"
|
||||
width="52px" height="52px"
|
||||
class="dashboard-brand">
|
||||
</div>
|
||||
</a>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 160">
|
||||
<g transform="scale(1, 0.5)">
|
||||
<path fill="#8fb677" fill-opacity="1"
|
||||
d="M0,192L60,170.7C120,149,240,107,360,96C480,85,600,107,720,138.7C840,171,960,213,1080,197.3C1200,181,1320,107,1380,69.3L1440,32L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
<aside class="menu">
|
||||
<p class="menu-label">
|
||||
Servers
|
||||
</p>
|
||||
<ul class="menu-list guildList">
|
||||
|
||||
</ul>
|
||||
<div class="aside-footer">
|
||||
<p class="menu-label">
|
||||
Options
|
||||
</p>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a class="show-modal" data-modal="dataManagerModal">
|
||||
<span class="icon"><i class="fas fa-exchange"></i></span> Import/Export
|
||||
</a>
|
||||
<a class="show-modal" data-modal="chooseTimezoneModal">
|
||||
<span class="icon"><i class="fas fa-map-marked"></i></span> Timezone
|
||||
</a>
|
||||
<a href="/login/discord/logout">
|
||||
<span class="icon"><i class="fas fa-sign-out"></i></span> Log out
|
||||
</a>
|
||||
<a href="https://discord.jellywx.com" class="feedback">
|
||||
<span class="icon"><i class="fab fa-discord"></i></span> Give feedback
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-sidebar mobile-sidebar is-hidden-desktop" id="mobileSidebar">
|
||||
<a href="/">
|
||||
<div class="brand">
|
||||
<img src="/static/img/logo_nobg.webp" alt="Reminder bot logo"
|
||||
class="dashboard-brand">
|
||||
</div>
|
||||
</a>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 160">
|
||||
<g transform="scale(1, 0.5)">
|
||||
<path fill="#8fb677" fill-opacity="1"
|
||||
d="M0,192L60,170.7C120,149,240,107,360,96C480,85,600,107,720,138.7C840,171,960,213,1080,197.3C1200,181,1320,107,1380,69.3L1440,32L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
<aside class="menu">
|
||||
<p class="menu-label">
|
||||
Servers
|
||||
</p>
|
||||
<ul class="menu-list guildList">
|
||||
|
||||
</ul>
|
||||
<div class="aside-footer">
|
||||
<p class="menu-label">
|
||||
Settings
|
||||
</p>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a class="show-modal" data-modal="dataManagerModal">
|
||||
<span class="icon"><i class="fas fa-exchange"></i></span> Import/Export
|
||||
</a>
|
||||
<a class="show-modal" data-modal="chooseTimezoneModal">
|
||||
<span class="icon"><i class="fas fa-map-marked"></i></span> Timezone
|
||||
</a>
|
||||
<a href="/login/discord/logout">
|
||||
<span class="icon"><i class="fas fa-sign-out"></i></span> Log out
|
||||
</a>
|
||||
<a href="https://discord.jellywx.com/" class="feedback">
|
||||
<span class="icon"><i class="fab fa-discord"></i></span> Give feedback
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<!-- main content -->
|
||||
<div class="column is-main-content">
|
||||
<p class="title pageTitle"></p>
|
||||
<section id="welcome">
|
||||
<div class="has-text-centered">
|
||||
<p class="title">Welcome!</p>
|
||||
<p class="subtitle is-hidden-touch">Select an option from the side to get started</p>
|
||||
<p class="subtitle is-hidden-desktop">Press the <span class="icon"><i class="fal fa-bars"></i></span> to get started</p>
|
||||
</div>
|
||||
</section>
|
||||
<section id="reminders" class="is-hidden">
|
||||
{% include "reminder_dashboard/reminder_dashboard" %}
|
||||
</section>
|
||||
<section id="reminder-errors" class="is-hidden">
|
||||
{% include "reminder_dashboard/reminder_errors" %}
|
||||
</section>
|
||||
<section id="guild-error" class="is-hidden">
|
||||
{% include "reminder_dashboard/guild_error" %}
|
||||
</section>
|
||||
<section id="user-error" class="is-hidden">
|
||||
{% include "reminder_dashboard/user_error" %}
|
||||
</section>
|
||||
</div>
|
||||
<!-- /main content -->
|
||||
</div>
|
||||
|
||||
<template id="embedFieldTemplate">
|
||||
<div data-inlined="1" class="embed-field-box">
|
||||
<div class="is-flex">
|
||||
<label>
|
||||
<span class="is-sr-only">Field Title</span>
|
||||
<textarea class="discord-field-title field-input message-input autoresize"
|
||||
placeholder="Field Title..." rows="1"
|
||||
maxlength="256" name="embed_field_title[]"></textarea>
|
||||
</label>
|
||||
<button class="button is-small inline-btn">
|
||||
<span class="is-sr-only">Toggle field inline</span><i class="fas fa-arrows-h"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<label>
|
||||
<span class="is-sr-only">Field Value</span>
|
||||
<textarea
|
||||
class="discord-field-value field-input message-input autoresize"
|
||||
placeholder="Field Value..."
|
||||
maxlength="1024" name="embed_field_value[]"
|
||||
rows="1"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="guildListEntry">
|
||||
<li>
|
||||
<a class="switch-pane" data-pane="guild">
|
||||
<span class="icon"><i class="fas fa-map-pin"></i></span> <span class="guild-name">%guildname%</span>
|
||||
</a>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<template id="guildReminder">
|
||||
{% include "reminder_dashboard/guild_reminder" %}
|
||||
</template>
|
||||
|
||||
<script src="/static/js/iro.js"></script>
|
||||
<script src="/static/js/dtsel.js"></script>
|
||||
|
||||
<script src="/static/js/interval.js?v{{ version }}"></script>
|
||||
<script src="/static/js/timezone.js?v{{ version }}" defer></script>
|
||||
<script src="/static/js/main.js?v{{ version }}" defer></script>
|
||||
|
||||
</body>
|
||||
</html>
|
17
templates/reminder_dashboard/guild_error.html.tera
Normal file
17
templates/reminder_dashboard/guild_error.html.tera
Normal file
|
@ -0,0 +1,17 @@
|
|||
<div class="hero is-fullheight">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<p class="title">
|
||||
We couldn't get this server's data
|
||||
</p>
|
||||
<p class="subtitle">
|
||||
Please check Reminder Bot is in the server, and has correct permissions.
|
||||
</p>
|
||||
<a class="button is-size-4 is-rounded is-success" href="https://invite.reminder-bot.com">
|
||||
<p class="is-size-4">
|
||||
<span>Add to Server</span> <span class="icon"><i class="fas fa-chevron-right"></i></span>
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
269
templates/reminder_dashboard/guild_reminder.html.tera
Normal file
269
templates/reminder_dashboard/guild_reminder.html.tera
Normal file
|
@ -0,0 +1,269 @@
|
|||
<div class="reminderContent {% if creating %}creator{% endif %}">
|
||||
<div class="columns is-mobile column reminder-topbar">
|
||||
{% if not creating %}
|
||||
<div class="invert-collapses channel-bar">
|
||||
#channel
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="name-bar">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<label class="label sr-only">Reminder Name</label>
|
||||
<input class="input" type="text" name="name" placeholder="Reminder Name" maxlength="100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-button-bar">
|
||||
<button class="button hide-box">
|
||||
<span class="is-sr-only">Hide reminder</span><i class="fas fa-chevron-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns reminder-settings">
|
||||
<div class="column discord-frame">
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-32x32 customizable">
|
||||
<a>
|
||||
<img class="is-rounded avatar" src="/static/img/bg.webp" alt="Image for discord avatar">
|
||||
</a>
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<div class="discord-message-header">
|
||||
<label class="is-sr-only">Username Override</label>
|
||||
<input class="discord-username message-input" placeholder="Username Override"
|
||||
maxlength="32" name="username">
|
||||
</div>
|
||||
<label class="is-sr-only">Message</label>
|
||||
<textarea class="message-input autoresize discord-content"
|
||||
placeholder="Message Content..."
|
||||
maxlength="2000" name="content" rows="1"></textarea>
|
||||
|
||||
<div class="discord-embed">
|
||||
<div class="embed-body">
|
||||
<button class="change-color button is-rounded is-small">
|
||||
<span class="is-sr-only">Choose embed color</span><i class="fas fa-eye-dropper"></i>
|
||||
</button>
|
||||
<div class="a">
|
||||
<div class="embed-author-box">
|
||||
<div class="a">
|
||||
<p class="image is-24x24 customizable">
|
||||
<a>
|
||||
<img class="is-rounded embed_author_url" src="/static/img/bg.webp" alt="Image for embed author">
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="b">
|
||||
<label class="is-sr-only" for="embedAuthor">Embed Author</label>
|
||||
<textarea
|
||||
class="discord-embed-author message-input autoresize"
|
||||
placeholder="Embed Author..." rows="1" maxlength="256"
|
||||
name="embed_author"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="is-sr-only" for="embedTitle">Embed Title</label>
|
||||
<textarea class="discord-title message-input autoresize"
|
||||
placeholder="Embed Title..."
|
||||
maxlength="256" rows="1"
|
||||
name="embed_title"></textarea>
|
||||
<br>
|
||||
<label class="is-sr-only" for="embedDescription">Embed Description</label>
|
||||
<textarea class="discord-description message-input autoresize "
|
||||
placeholder="Embed Description..."
|
||||
maxlength="4096" name="embed_description"
|
||||
rows="1"></textarea>
|
||||
<br>
|
||||
|
||||
<div class="embed-multifield-box">
|
||||
<div data-inlined="1" class="embed-field-box">
|
||||
<label class="is-sr-only" for="embedFieldTitle">Field Title</label>
|
||||
<div class="is-flex">
|
||||
<textarea class="discord-field-title field-input message-input autoresize"
|
||||
placeholder="Field Title..." rows="1"
|
||||
maxlength="256" name="embed_field_title[]"></textarea>
|
||||
<button class="button is-small inline-btn">
|
||||
<span class="is-sr-only">Toggle field inline</span><i class="fas fa-arrows-h"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<label class="is-sr-only" for="embedFieldValue">Field Value</label>
|
||||
<textarea
|
||||
class="discord-field-value field-input message-input autoresize "
|
||||
placeholder="Field Value..."
|
||||
maxlength="1024" name="embed_field_value[]"
|
||||
rows="1"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="b">
|
||||
<p class="image thumbnail customizable">
|
||||
<a>
|
||||
<img class="embed_thumbnail_url" src="/static/img/bg.webp" alt="Square thumbnail embedded image">
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="image is-400x300 customizable">
|
||||
<a>
|
||||
<img class="embed_image_url" src="/static/img/bg.webp" alt="Large embedded image">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div class="embed-footer-box">
|
||||
<p class="image is-20x20 customizable">
|
||||
<a>
|
||||
<img class="is-rounded embed_footer_url" src="/static/img/bg.webp" alt="Footer profile-like image">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<label class="is-sr-only" for="embedFooter">Embed Footer text</label>
|
||||
<textarea class="discord-embed-footer message-input autoresize "
|
||||
placeholder="Embed Footer..."
|
||||
maxlength="2048" name="embed_footer" rows="1"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<div class="column settings">
|
||||
<div class="field channel-field">
|
||||
<div class="collapses">
|
||||
<label class="label" for="channelOption">Channel*</label>
|
||||
</div>
|
||||
<div class="control has-icons-left">
|
||||
<div class="select">
|
||||
<select name="channel" class="channel-selector">
|
||||
</select>
|
||||
</div>
|
||||
<div class="icon is-small is-left">
|
||||
<i class="fas fa-hashtag"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<label class="label collapses">
|
||||
Time*
|
||||
<input class="input prefill-now" type="datetime-local" step="1" name="time">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="collapses split-controls">
|
||||
<div>
|
||||
<div class="patreon-only">
|
||||
<div class="patreon-invert foreground">
|
||||
Intervals available on <a href="https://patreon.com/jellywx">Patreon</a> or <a href="https://gitea.jellypro.xyz/jude/reminder-bot">self-hosting</a>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">Interval <a class="foreground" href="/help/intervals"><i class="fas fa-question-circle"></i></a></label>
|
||||
<div class="control intervalSelector">
|
||||
<div class="input interval-group">
|
||||
<div class="interval-group-left">
|
||||
<span class="no-break">
|
||||
<label>
|
||||
<span class="is-sr-only">Interval months</span>
|
||||
<input class="w2" type="text" pattern="\d*" name="interval_months" maxlength="2" placeholder=""> <span class="half-rem"></span> months, <span class="half-rem"></span>
|
||||
</label>
|
||||
<label>
|
||||
<span class="is-sr-only">Interval days</span>
|
||||
<input class="w3" type="text" pattern="\d*" name="interval_days" maxlength="4" placeholder=""> <span class="half-rem"></span> days, <span class="half-rem"></span>
|
||||
</label>
|
||||
</span>
|
||||
<span class="no-break">
|
||||
<label>
|
||||
<span class="is-sr-only">Interval hours</span>
|
||||
<input class="w2" type="text" pattern="\d*" name="interval_hours" maxlength="2" placeholder="HH">:
|
||||
</label>
|
||||
<label>
|
||||
<span class="is-sr-only">Interval minutes</span>
|
||||
<input class="w2" type="text" pattern="\d*" name="interval_minutes" maxlength="2" placeholder="MM">:
|
||||
</label>
|
||||
<label>
|
||||
<span class="is-sr-only">Interval seconds</span>
|
||||
<input class="w2" type="text" pattern="\d*" name="interval_seconds" maxlength="2" placeholder="SS">
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
<button class="clear"><span class="is-sr-only">Clear interval</span><span class="icon"><i class="fas fa-trash"></i></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<label class="label">
|
||||
Expiration
|
||||
<input class="input" type="datetime-local" step="1" name="expiration">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns is-mobile tts-row">
|
||||
<div class="column has-text-centered">
|
||||
<div class="is-boxed">
|
||||
<label class="label">Enable TTS <input type="checkbox" name="tts"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column has-text-centered">
|
||||
<div class="file is-small is-boxed">
|
||||
<label class="file-label">
|
||||
<input class="file-input" type="file" name="attachment">
|
||||
<span class="file-cta">
|
||||
<span class="file-label">
|
||||
Add Attachment
|
||||
</span>
|
||||
<span class="file-icon">
|
||||
<i class="fas fa-upload"></i>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if creating %}
|
||||
<div class="button-row">
|
||||
<div class="button-row-reminder">
|
||||
<button class="button is-success" id="createReminder">
|
||||
<span>Create Reminder</span> <span class="icon"><i class="fas fa-sparkles"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="button-row-template">
|
||||
<div>
|
||||
<button class="button is-success is-outlined" id="createTemplate">
|
||||
<span>Create Template</span> <span class="icon"><i class="fas fa-file-spreadsheet"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="button is-outlined show-modal is-pulled-right" data-modal="chooseTemplateModal">
|
||||
Load Template
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="button-row-edit">
|
||||
<button class="button is-success save-btn">
|
||||
<span>Save</span> <span class="icon"><i class="fas fa-save"></i></span>
|
||||
</button>
|
||||
<button class="button is-warning disable-enable">
|
||||
</button>
|
||||
<button class="button is-danger delete-reminder">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
52
templates/reminder_dashboard/reminder_dashboard.html.tera
Normal file
52
templates/reminder_dashboard/reminder_dashboard.html.tera
Normal file
|
@ -0,0 +1,52 @@
|
|||
<div class="create-reminder">
|
||||
<strong>Create Reminder</strong>
|
||||
<div id="reminderCreator">
|
||||
{% set creating = true %}
|
||||
{% include "reminder_dashboard/guild_reminder" %}
|
||||
{% set creating = false %}
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="field">
|
||||
<div class="columns is-mobile">
|
||||
<div class="column">
|
||||
<strong>Reminders</strong>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<div class="control has-icons-left">
|
||||
<div class="select is-small">
|
||||
<select id="orderBy">
|
||||
<option value="time" selected>Time</option>
|
||||
<option value="name">Name</option>
|
||||
<option value="channel">Channel</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="icon is-small is-left">
|
||||
<i class="fas fa-sort-amount-down"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<div class="control has-icons-left">
|
||||
<div class="select is-small">
|
||||
<select id="expandAll">
|
||||
<option value="" selected></option>
|
||||
<option value="expand">Expand All</option>
|
||||
<option value="collapse">Collapse All</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="icon is-small is-left">
|
||||
<i class="fas fa-expand-arrows"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="guildReminders">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/sort.js"></script>
|
||||
<script src="/static/js/expand.js"></script>
|
5
templates/reminder_dashboard/reminder_errors.html.tera
Normal file
5
templates/reminder_dashboard/reminder_errors.html.tera
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--<script src="/static/js/reminder_errors.js"></script>-->
|
12
templates/reminder_dashboard/user_error.html.tera
Normal file
12
templates/reminder_dashboard/user_error.html.tera
Normal file
|
@ -0,0 +1,12 @@
|
|||
<div class="hero is-fullheight">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<p class="title">
|
||||
You do not have permissions for this server
|
||||
</p>
|
||||
<p class="subtitle">
|
||||
Ask an admin to grant you the "Manage Messages" permission.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user