Skip to content

Commit

Permalink
Cl893/fix prod bugs (#219)
Browse files Browse the repository at this point in the history
* ui fixes

* fix joining orgs

* fix completer bug

* Fix events issues

* fix challenge completed page ui

* Delete cascades

* fix i've arrived race condition and reversed copied event

* fix more ui

* updated progress bars

* Fix tests + launcher

* edit color of challenge completed progress bar

---------

Co-authored-by: neketka <[email protected]>
  • Loading branch information
cathli66 and neketka authored May 2, 2024
1 parent 0d314e4 commit e4213d3
Show file tree
Hide file tree
Showing 25 changed files with 766 additions and 648 deletions.
10 changes: 5 additions & 5 deletions admin/src/components/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function EventCard(props: {
props.event.difficulty === "Easy"
? "Easy"
: props.event.difficulty === "Normal"
? "Normal"
: "Hard";
? "Normal"
: "Hard";

let categoryInput = props.event.category as string;
const categoryType =
Expand Down Expand Up @@ -158,8 +158,8 @@ function fromForm(form: EntryForm[], id: string): EventDto {
(form[5] as OptionEntryForm).value === 0
? EventDifficultyDto.Easy
: (form[5] as OptionEntryForm).value === 1
? EventDifficultyDto.Normal
: EventDifficultyDto.Hard,
? EventDifficultyDto.Normal
: EventDifficultyDto.Hard,

latitudeF: 0,
longitudeF: 0,
Expand Down Expand Up @@ -290,7 +290,7 @@ export function Events() {
setCopyModalOpen(false);
return;
}
for (const chalId of ev.challenges!) {
for (const chalId of [...ev.challenges!].reverse()!) {
const chal = serverData.challenges.get(chalId)!;
serverData.updateChallenge({
...chal,
Expand Down
98 changes: 17 additions & 81 deletions game/lib/achievements/achievement_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,7 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class LoadingBar extends StatelessWidget {
final int totalTasks;
final int tasksFinished;

const LoadingBar(
this.tasksFinished,
this.totalTasks,
);

@override
Widget build(BuildContext context) {
return Row(
children: [
Container(
width: 200,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Stack(children: [
Container(
width: constraints.maxWidth,
height: 13,
alignment: Alignment.centerLeft,
child: Container(
decoration: new BoxDecoration(
color: Color.fromARGB(255, 241, 241, 241),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(16.0)),
),
),
),
Container(
width: (totalTasks > 0 ? tasksFinished / totalTasks : 0) *
constraints.maxWidth,
height: 13,
alignment: Alignment.centerLeft,
child: Container(
decoration: new BoxDecoration(
color: Color.fromARGB(197, 237, 86, 86),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(16.0)),
),
),
),
Container(
height: 3,
width: max(
(totalTasks > 0 ? tasksFinished / totalTasks : 0) *
constraints.maxWidth -
16,
0),
margin: EdgeInsets.only(left: 8, top: 3),
alignment: Alignment.centerLeft,
decoration: new BoxDecoration(
color: Color(0x99F3C6C6),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
),
]);
})),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
tasksFinished.toString() + "/" + totalTasks.toString(),
),
),
],
);
}
}
import 'package:game/widget/progress_bar.dart';

class AchievementCell extends StatefulWidget {
final SvgPicture thumbnail;
Expand Down Expand Up @@ -109,7 +39,9 @@ class _AchievementCellState extends State<AchievementCell> {
return GestureDetector(
onTap: () async {},
child: Container(
padding: EdgeInsets.all(5),
width: MediaQuery.sizeOf(context).width * 0.85,
height: MediaQuery.sizeOf(context).height * 0.11,
//padding: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
Expand All @@ -122,8 +54,7 @@ class _AchievementCellState extends State<AchievementCell> {
],
),
child: Container(
margin: EdgeInsets.all(10),
height: 64,
padding: EdgeInsets.all(10),
child: Row(
children: [
Container(margin: EdgeInsets.only(right: 12), child: thumbnail),
Expand All @@ -134,13 +65,18 @@ class _AchievementCellState extends State<AchievementCell> {
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(
description,
style: TextStyle(
color: Color.fromARGB(204, 0, 0, 0),
fontSize: 14,
fontFamily: 'Poppins',
fontWeight: FontWeight.w500,
child: Container(
width: MediaQuery.sizeOf(context).width * 0.45,
child: Text(
description,
maxLines: 2,
overflow: TextOverflow.clip,
style: TextStyle(
color: Color.fromARGB(204, 0, 0, 0),
fontSize: 14,
fontFamily: 'Poppins',
fontWeight: FontWeight.w500,
),
),
),
),
Expand Down
8 changes: 6 additions & 2 deletions game/lib/api/game_server_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ class GameServerApi {
completer.complete(arg);
};

Future.delayed(Duration(seconds: 5))
.then((value) => completer.complete(null));
Future.delayed(Duration(seconds: 5)).then((value) {
if (completer.isCompleted) {
return;
}
completer.complete(null);
});

_refreshEv = ev;
_refreshDat = data;
Expand Down
17 changes: 8 additions & 9 deletions game/lib/challenges/challenge_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ class _ChallengeCellState extends State<ChallengeCell> {
),
],
),
height: 135.0,
height: MediaQuery.sizeOf(context).height * 0.15,
width: MediaQuery.sizeOf(context).width * 0.85,
child: Padding(
padding: EdgeInsets.all(16.0),
padding: EdgeInsets.all(16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expand All @@ -116,7 +117,9 @@ class _ChallengeCellState extends State<ChallengeCell> {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(4.6)),
child: Image.network(imgUrl,
width: 100, height: 100, fit: BoxFit.cover),
width: MediaQuery.sizeOf(context).height * 0.1,
height: MediaQuery.sizeOf(context).height * 0.1,
fit: BoxFit.cover),
),
),
Expanded(
Expand All @@ -139,9 +142,7 @@ class _ChallengeCellState extends State<ChallengeCell> {
),
],
),
SizedBox(
height: 4,
),
Spacer(),
Text(
challengeName,
style: TextStyle(
Expand All @@ -151,9 +152,7 @@ class _ChallengeCellState extends State<ChallengeCell> {
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 12,
),
Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expand Down
2 changes: 1 addition & 1 deletion game/lib/challenges/challenges_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class _ChallengesPageState extends State<ChallengesPage> {
color: Color.fromARGB(255, 255, 248, 241),
),
child: Padding(
padding: EdgeInsets.all(30),
padding: EdgeInsets.all(16),
child: Stack(
children: [
Align(
Expand Down
Loading

0 comments on commit e4213d3

Please sign in to comment.