mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 06:12:18 +00:00
UI sorting works
This commit is contained in:
1 parent
036e37a120
commit
568f7bd9f6
2 files changed
+30
-4
No files matched your search
@@ -41,6 +41,7 @@ function TtsConfigsReorderPage(props: Props) {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('useEffect');
|
||||
let maybeTwitchEventCategory = TWITCH_EVENT_CATEGORY_BY_STRING.get(event_category);
|
||||
|
||||
if (maybeTwitchEventCategory === undefined) {
|
||||
@@ -53,11 +54,40 @@ function TtsConfigsReorderPage(props: Props) {
|
||||
}, [listTwitchEventRules, event_category, history]);
|
||||
|
||||
const handleMoveUp = (ruleIndex: number) => {
|
||||
let newEventRules = [...twitchEventRules];
|
||||
|
||||
if (ruleIndex >= newEventRules.length || // Walk off end
|
||||
ruleIndex === 0) { // Can't move up.
|
||||
return false;
|
||||
}
|
||||
|
||||
let aboveIndex = ruleIndex - 1;
|
||||
let aboveRule = newEventRules[aboveIndex];
|
||||
|
||||
newEventRules[aboveIndex] = newEventRules[ruleIndex];
|
||||
newEventRules[ruleIndex] = aboveRule;
|
||||
|
||||
setTwitchEventRules(newEventRules);
|
||||
}
|
||||
|
||||
const handleMoveDown = (ruleIndex: number) => {
|
||||
let newEventRules = [...twitchEventRules];
|
||||
|
||||
if (ruleIndex < 0 || // Invalid
|
||||
ruleIndex >= newEventRules.length - 1) { // Can't move down.
|
||||
return false;
|
||||
}
|
||||
|
||||
let belowIndex = ruleIndex + 1;
|
||||
|
||||
console.log(ruleIndex, belowIndex);
|
||||
|
||||
let belowRule = newEventRules[belowIndex];
|
||||
|
||||
newEventRules[belowIndex] = newEventRules[ruleIndex];
|
||||
newEventRules[ruleIndex] = belowRule;
|
||||
|
||||
setTwitchEventRules(newEventRules);
|
||||
}
|
||||
|
||||
if (!props.sessionWrapper.isLoggedIn()) {
|
||||
|
||||
-4
@@ -23,10 +23,6 @@ function ReorderableTwitchEventRuleElement(props: Props) {
|
||||
let subtitle = <></>;
|
||||
let description = <></>;
|
||||
|
||||
const handleClickUp = (ev: React.FormEvent<HTMLButtonElement>) : boolean => {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (props.rule.event_match_predicate.bits_cheermote_name_exact_match !== undefined) {
|
||||
title = "Cheermote Name Matches"
|
||||
subtitle = (
|
||||
|
||||
Reference in new issue
Block a user