mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 17:19:10 +00:00
add an instant cache refresh to the editor
This commit is contained in:
parent
68b2b7323b
commit
0836d548b2
6 changed files with 66 additions and 11 deletions
|
@ -15,6 +15,7 @@ export type EditorShellProps = {
|
|||
onGuildChange?: (guild: PresentableGuild) => void;
|
||||
onCategoryChange?: (category: Category) => void;
|
||||
onMessageChange?: (message: PresentableGuild['data']['message']) => void;
|
||||
onRefreshCache?: () => void;
|
||||
};
|
||||
|
||||
export const EditorShell = (props: EditorShellProps) => {
|
||||
|
@ -69,7 +70,11 @@ export const EditorShell = (props: EditorShellProps) => {
|
|||
guild={guild.guild}
|
||||
/>
|
||||
<Space />
|
||||
<ServerCategoryEditor guild={guild} onChange={replaceCategories} />
|
||||
<ServerCategoryEditor
|
||||
guild={guild}
|
||||
onChange={replaceCategories}
|
||||
onRefreshCache={props.onRefreshCache}
|
||||
/>
|
||||
<LinedSpace />
|
||||
<ServerUtilities guildData={guild.data} />
|
||||
</Container>
|
||||
|
|
|
@ -15,7 +15,14 @@ import { flatten, sortBy } from 'lodash';
|
|||
import React from 'react';
|
||||
import { DragDropContext, Draggable, Droppable, DropResult } from 'react-beautiful-dnd';
|
||||
import { CgReorder } from 'react-icons/cg';
|
||||
import { GoArrowDown, GoArrowUp, GoCheck, GoGrabber, GoPlus } from 'react-icons/go';
|
||||
import {
|
||||
GoArrowDown,
|
||||
GoArrowUp,
|
||||
GoCheck,
|
||||
GoGrabber,
|
||||
GoPlus,
|
||||
GoSync,
|
||||
} from 'react-icons/go';
|
||||
import { ulid } from 'ulidx';
|
||||
import {
|
||||
CategoryActions,
|
||||
|
@ -26,6 +33,7 @@ import {
|
|||
type Props = {
|
||||
guild: PresentableGuild;
|
||||
onChange: (categories: PresentableGuild['data']['categories']) => void;
|
||||
onRefreshCache?: () => void;
|
||||
};
|
||||
|
||||
const resetOrder = (categories: Category[]) =>
|
||||
|
@ -126,6 +134,9 @@ export const ServerCategoryEditor = (props: Props) => {
|
|||
<Button color="muted" size="small" onClick={() => setReorderMode(true)}>
|
||||
Change Order <CgReorder />
|
||||
</Button>
|
||||
<Button color="muted" size="small" onClick={props.onRefreshCache}>
|
||||
Refresh Roles <GoSync />
|
||||
</Button>
|
||||
</CategoryActions>
|
||||
{props.guild.data.categories.length > 0 ? (
|
||||
sortBy(props.guild.data.categories, ['position', 'id']).map((category, idx) => (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue