Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.7.0 #25

Merged
merged 23 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4459bd2
feat(footer): update copyright year
ZRunner Jan 1, 2025
44b0c38
feat(rss): add basic message preview
ZRunner Jan 3, 2025
2290992
refact(fonts): preload main fonts, reduce MPLUS2 font size
ZRunner Jan 4, 2025
a77082d
feat(DiscordMessagePreview): add verified app badge
ZRunner Jan 4, 2025
ce0254b
fix(DiscordMessagePreview): invalid html attributes
ZRunner Jan 5, 2025
6db8e32
feat(rss): start adding embed configuration options
ZRunner Jan 5, 2025
b2c4518
feat(rss): add remaining embed configuration options
ZRunner Jan 5, 2025
156d9a8
refact(rss): improve performances with multiple feeds
ZRunner Jan 5, 2025
cee265b
refact(build): lazy-load FeedComponent and UploadLeaderboardButton
ZRunner Jan 5, 2025
840994f
refact(rss): add info message when no rss feed exists
ZRunner Jan 6, 2025
1680ebb
feat(rss): allow feed deletion
ZRunner Jan 6, 2025
6aee46f
fix(theme): Switch color when disabled
ZRunner Jan 6, 2025
488c35e
feat(rss): allow hiding feed preview
ZRunner Jan 6, 2025
a589596
refact(rss): instant toggle instead of save
ZRunner Jan 18, 2025
fefc96f
refact(rss): use individual save system
ZRunner Jan 19, 2025
fdf7991
refact(Stack): use spacing instead of gap property
ZRunner Jan 19, 2025
07b86af
refact(rss): sort by name/url instead of creation date
ZRunner Jan 19, 2025
21c48d8
refact(rss): simplify bg color + add confirmation on close
ZRunner Jan 19, 2025
539e88d
feat(rss): suggest saving before changing tab
ZRunner Jan 19, 2025
fb7b519
refact(logs): rewrite rss logs + color author in white
ZRunner Jan 19, 2025
2f1b83f
build(deps): bump vite from 5.4.8 to 5.4.14
dependabot[bot] Jan 22, 2025
0b690f7
build(deps): bump vite from 5.4.8 to 5.4.14 (#24)
ZRunner Jan 26, 2025
3a98f31
feat(DiscordMessagePreview): add markdown rendering
ZRunner Feb 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<meta name="msapplication-TileColor" content="#da532c">

<link rel="dns-prefetch" href="https://cdn.discordapp.com" />
<link rel="preload" href="/assets/fonts/MPLUS2-VariableFont-latin.woff" as="font" type="font/woff" crossorigin>
<link rel="preload" href="/assets/fonts/Poppins-Regular.ttf" as="font" type="font/ttf" crossorigin>
<link rel="preconnect" href="https://zrunner.me" crossorigin />
<link rel="preconnect" href=%VITE_API_URL% />
<link rel="manifest" href="/manifest.json" />
Expand Down
86 changes: 80 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axobot-web",
"version": "0.6.0",
"version": "0.7.0",
"type": "module",
"private": true,
"dependencies": {
Expand All @@ -15,6 +15,7 @@
"discord-api-types": "^0.37.92",
"express": "^4.21.2",
"express-rate-limit": "^7.4.0",
"markdown-it": "^14.1.0",
"morgan": "^1.10.0",
"mui-color-input": "^4.0.0",
"react": "^18.3.0",
Expand All @@ -27,7 +28,7 @@
"sirv": "^2.0.4",
"typescript": "^5.6.2",
"typia": "^6.10.0",
"vite": "^5.4.6",
"vite": "^5.4.14",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.1",
"web-vitals": "^2.1.4"
Expand Down Expand Up @@ -60,6 +61,7 @@
"devDependencies": {
"@stylistic/eslint-plugin": "^2.9.0",
"@types/jest": "^27.5.2",
"@types/markdown-it": "^14.1.2",
"@types/node": "^20.11.25",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
Expand Down
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const defaultSrcPolicy = isProduction ? "default-src https:" : "";
const scriptSrcPolicy = isProduction ? `script-src-elem ${env.PUBLIC_URL} ${env.VITE_API_URL} https://static.cloudflareinsights.com https://zrunner.me` : "";
const styleSrcPolicy = isProduction ? "style-src 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='" : "";
const headers = {
"Content-Security-Policy": `frame-ancestors 'none'; upgrade-insecure-requests; ${defaultSrcPolicy}; ${scriptSrcPolicy}; ${styleSrcPolicy}; img-src 'self' https://cdn.discordapp.com`,
"Content-Security-Policy": `frame-ancestors 'none'; upgrade-insecure-requests; ${defaultSrcPolicy}; ${scriptSrcPolicy}; ${styleSrcPolicy}; img-src https:`,
"Cross-Origin-Embedder-Policy": "credentialless",
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Resource-Policy": "same-site",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function FloatConfigComponent({ optionId, option }: FloatConfigCo

return (
<ComplexConfiguration optionId={optionId}>
<Stack direction="row" gap={2}>
<Stack direction="row" spacing={2}>
<Slider
aria-label={optionId}
defaultValue={defaultValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function LevelupChannelConfigComponent({ optionId, option }: Leve

return (
<LargeConfiguration optionId={optionId}>
<Stack gap={1}>
<Stack spacing={1}>
<StyledSelect
value={currentEnumValue}
onChange={(e) => onChange(e.target.value as string)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function ComplexConfiguration({ optionId, children }: PropsWithChildren<S
function EditedBadge() {
return (
<Tooltip title="This configuration has been edited and needs to be saved.">
<Stack direction="row" gap={0.5} component="span" display="inline-flex" sx={{ verticalAlign: "sub" }}>
<Stack direction="row" spacing={0.5} component="span" display="inline-flex" sx={{ verticalAlign: "sub" }}>
<SyncProblemIcon color="warning" fontSize="small" />
<Typography component="span" variant="caption" color="text.secondary" sx={{ display: "inline-block" }}>Edited</Typography>
</Stack>
Expand Down
51 changes: 41 additions & 10 deletions src/components/GuildDashboard/NavigationDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import MenuIcon from "@mui/icons-material/Menu";
import { Badge, Box, CSSObject, Divider, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, styled, Theme, Toolbar } from "@mui/material";
import MuiDrawer from "@mui/material/Drawer";
import { Fragment, useState } from "react";
import { Fragment, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { Link, useLocation } from "react-router-dom";
import { useLocation, useNavigate } from "react-router-dom";

import { getGuildDashboardTranslations } from "../../i18n/i18n";
import { useGuildConfigEditionContext } from "../../repository/context/GuildConfigEditionContext";
import { GuildConfigOptionCategory, GuildConfigOptionCategoryNames } from "../../repository/types/guild-config-types";
import { useIsOnMobile } from "../../styles/useIsOnMobile";
import UnsavedFeedsConfirmationDialog from "./SpecialCategoryComponents/RssFeeds/UnsavedFeedsConfirmationDialog";

const drawerWidth = 240;

Expand Down Expand Up @@ -126,9 +127,7 @@ function getPageTitle(page: string) {
return getGuildDashboardTranslations(`category_name.${page}`);
}

function TabContent({ page, isOpen }: { page: GuildConfigOptionCategory; isOpen: boolean }) {
const { getCategoriesWithUnsavedChanges } = useGuildConfigEditionContext();
const unsavedCategories = getCategoriesWithUnsavedChanges();
function TabContent({ page, isOpen, isUnsaved }: { page: GuildConfigOptionCategory; isOpen: boolean; isUnsaved: boolean }) {
const formatedTitle = getPageTitle(page);

return (
Expand All @@ -141,7 +140,7 @@ function TabContent({ page, isOpen }: { page: GuildConfigOptionCategory; isOpen:
justifyContent: "center",
}}
>
<Badge color="warning" variant="dot" invisible={!unsavedCategories.includes(page)}>
<Badge color="warning" variant="dot" invisible={!isUnsaved}>
<TabIcon page={page} />
</Badge>
</ListItemIcon>
Expand All @@ -157,7 +156,36 @@ interface NavigationDrawerContentProps {
}

function NavigationDrawerContent({ open, activePage, toggleOpen }: NavigationDrawerContentProps) {
const { getCategoriesWithUnsavedChanges } = useGuildConfigEditionContext();
const unsavedCategories = getCategoriesWithUnsavedChanges();
const isOnMobile = useIsOnMobile();
const navigate = useNavigate();

const [isUnsavedFeedsDialogOpen, setIsUnsavedFeedsDialogOpen] = useState(false);
const destinationPage = useRef<GuildConfigOptionCategory | null>(null);

function handleClickOnTab(page: GuildConfigOptionCategory) {
return async () => {
if (activePage === "rss" && unsavedCategories.includes("rss")) {
destinationPage.current = page;
setIsUnsavedFeedsDialogOpen(true);
return;
}
navigate(page);
if (isOnMobile) {
toggleOpen();
}
};
}

const closeUnsavedFeedsDialog = () => setIsUnsavedFeedsDialogOpen(false);
const closeUnsavedFeedsDialogAndNavigate = () => {
closeUnsavedFeedsDialog();
if (destinationPage.current) {
navigate(destinationPage.current);
}
};

return (
<Fragment>
<Toolbar sx={{ display: { xs: "none", md: "initial" } }} />
Expand All @@ -174,16 +202,19 @@ function NavigationDrawerContent({ open, activePage, toggleOpen }: NavigationDra
<PageTab
isOpen={open}
isSelected={activePage === page}
component={Link}
to={page}
onClick={isOnMobile ? toggleOpen : undefined}
onClick={handleClickOnTab(page)}
>
<TabContent page={page} isOpen={open} />
<TabContent page={page} isOpen={open} isUnsaved={unsavedCategories.includes(page)} />
</PageTab>
</ListItem>
))}
</List>
</Box>
<UnsavedFeedsConfirmationDialog
open={isUnsavedFeedsDialogOpen}
onCancel={closeUnsavedFeedsDialog}
onConfirm={closeUnsavedFeedsDialogAndNavigate}
/>
</Fragment>
);
}
Expand Down
5 changes: 1 addition & 4 deletions src/components/GuildDashboard/SaveConfigBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface SaveConfigBannerProps {
}

export default function SaveConfigBanner({ guildId }: SaveConfigBannerProps) {
const { patchGuildConfigCommand, putRoleRewardsCommand, patchRssFeedsCommand, loading, success } = usePatchGuildConfig();
const { patchGuildConfigCommand, putRoleRewardsCommand, loading, success } = usePatchGuildConfig();
const { state, hasAnyUnsavedChange, resetState } = useGuildConfigEditionContext();
const isOnMobile = useIsOnMobile();

Expand All @@ -23,9 +23,6 @@ export default function SaveConfigBanner({ guildId }: SaveConfigBannerProps) {
if (state.roleRewards !== undefined) {
putRoleRewardsCommand(guildId, state.roleRewards);
}
if (state.rssFeeds !== undefined) {
patchRssFeedsCommand(guildId, state.rssFeeds);
}
}

useEffect(() => {
Expand Down
Loading
Loading