minor page tweaks
This commit is contained in:
@@ -10,7 +10,7 @@ class _TimelineGrid extends StatefulWidget {
|
||||
this.onEditEntry,
|
||||
this.onDeleteEntry,
|
||||
this.onModeratePending,
|
||||
this.pendingActionsBusy = false,
|
||||
this.pendingActionEventIds = const {},
|
||||
});
|
||||
|
||||
final List<LocoAttrVersion> entries;
|
||||
@@ -20,7 +20,7 @@ class _TimelineGrid extends StatefulWidget {
|
||||
LocoAttrVersion entry,
|
||||
_PendingModerationAction action,
|
||||
)? onModeratePending;
|
||||
final bool pendingActionsBusy;
|
||||
final Set<int> pendingActionEventIds;
|
||||
|
||||
@override
|
||||
State<_TimelineGrid> createState() => _TimelineGridState();
|
||||
@@ -201,7 +201,7 @@ class _TimelineGridState extends State<_TimelineGrid> {
|
||||
onEditEntry: widget.onEditEntry,
|
||||
onDeleteEntry: widget.onDeleteEntry,
|
||||
onModeratePending: widget.onModeratePending,
|
||||
pendingActionsBusy: widget.pendingActionsBusy,
|
||||
pendingActionEventIds: widget.pendingActionEventIds,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -288,7 +288,7 @@ class _AttrRow extends StatelessWidget {
|
||||
this.onEditEntry,
|
||||
this.onDeleteEntry,
|
||||
this.onModeratePending,
|
||||
this.pendingActionsBusy = false,
|
||||
this.pendingActionEventIds = const {},
|
||||
});
|
||||
|
||||
final double rowHeight;
|
||||
@@ -302,7 +302,7 @@ class _AttrRow extends StatelessWidget {
|
||||
LocoAttrVersion entry,
|
||||
_PendingModerationAction action,
|
||||
)? onModeratePending;
|
||||
final bool pendingActionsBusy;
|
||||
final Set<int> pendingActionEventIds;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -329,7 +329,7 @@ class _AttrRow extends StatelessWidget {
|
||||
onEditEntry: onEditEntry,
|
||||
onDeleteEntry: onDeleteEntry,
|
||||
onModeratePending: onModeratePending,
|
||||
pendingActionsBusy: pendingActionsBusy,
|
||||
pendingActionEventIds: pendingActionEventIds,
|
||||
),
|
||||
),
|
||||
if (activeBlock != null)
|
||||
@@ -346,7 +346,7 @@ class _AttrRow extends StatelessWidget {
|
||||
width: stickyWidth,
|
||||
),
|
||||
clipLeftEdge: scrollOffset > activeBlock.left + 0.1,
|
||||
pendingActionsBusy: pendingActionsBusy,
|
||||
pendingActionEventIds: pendingActionEventIds,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -368,12 +368,12 @@ class _ValueBlockView extends StatelessWidget {
|
||||
const _ValueBlockView({
|
||||
required this.block,
|
||||
this.clipLeftEdge = false,
|
||||
this.pendingActionsBusy = false,
|
||||
this.pendingActionEventIds = const {},
|
||||
});
|
||||
|
||||
final _ValueBlock block;
|
||||
final bool clipLeftEdge;
|
||||
final bool pendingActionsBusy;
|
||||
final Set<int> pendingActionEventIds;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -384,6 +384,11 @@ class _ValueBlockView extends StatelessWidget {
|
||||
? Colors.white
|
||||
: Colors.black87;
|
||||
|
||||
final entry = block.entry;
|
||||
final eventId = entry?.sourceEventId;
|
||||
final isPendingAction =
|
||||
entry?.isPending == true && eventId != null && pendingActionEventIds.contains(eventId);
|
||||
|
||||
final radius = BorderRadius.only(
|
||||
topLeft: Radius.circular(clipLeftEdge ? 0 : 12),
|
||||
bottomLeft: Radius.circular(clipLeftEdge ? 0 : 12),
|
||||
@@ -425,7 +430,7 @@ class _ValueBlockView extends StatelessWidget {
|
||||
child: SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: pendingActionsBusy
|
||||
child: isPendingAction
|
||||
? CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor:
|
||||
@@ -484,7 +489,7 @@ class _ValueBlockMenu extends StatelessWidget {
|
||||
this.onEditEntry,
|
||||
this.onDeleteEntry,
|
||||
this.onModeratePending,
|
||||
this.pendingActionsBusy = false,
|
||||
this.pendingActionEventIds = const {},
|
||||
});
|
||||
|
||||
final _ValueBlock block;
|
||||
@@ -494,7 +499,7 @@ class _ValueBlockMenu extends StatelessWidget {
|
||||
LocoAttrVersion entry,
|
||||
_PendingModerationAction action,
|
||||
)? onModeratePending;
|
||||
final bool pendingActionsBusy;
|
||||
final Set<int> pendingActionEventIds;
|
||||
|
||||
bool get _hasActions {
|
||||
final canModerate = block.entry?.isPending == true &&
|
||||
@@ -515,6 +520,9 @@ class _ValueBlockMenu extends StatelessWidget {
|
||||
block.entry?.canModeratePending == true &&
|
||||
onModeratePending != null;
|
||||
final canEdit = onEditEntry != null && block.entry?.isPending != true;
|
||||
final eventId = block.entry?.sourceEventId;
|
||||
final isPendingAction =
|
||||
eventId != null && pendingActionEventIds.contains(eventId);
|
||||
|
||||
Future<void> showContextMenuAt(Offset globalPosition) async {
|
||||
final overlay = Overlay.of(context);
|
||||
@@ -540,13 +548,13 @@ class _ValueBlockMenu extends StatelessWidget {
|
||||
if (canModerate)
|
||||
PopupMenuItem(
|
||||
value: _TimelineBlockAction.approve,
|
||||
enabled: !pendingActionsBusy,
|
||||
enabled: !isPendingAction,
|
||||
child: const Text('Approve pending'),
|
||||
),
|
||||
if (canModerate)
|
||||
PopupMenuItem(
|
||||
value: _TimelineBlockAction.reject,
|
||||
enabled: !pendingActionsBusy,
|
||||
enabled: !isPendingAction,
|
||||
child: const Text('Reject pending'),
|
||||
),
|
||||
if (onDeleteEntry != null)
|
||||
@@ -588,7 +596,7 @@ class _ValueBlockMenu extends StatelessWidget {
|
||||
},
|
||||
child: _ValueBlockView(
|
||||
block: block,
|
||||
pendingActionsBusy: pendingActionsBusy,
|
||||
pendingActionEventIds: pendingActionEventIds,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user