Skip to content

Commit

Permalink
chore: Merge origin/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder committed Jun 14, 2024
1 parent c5f9bee commit 8dad7c3
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 30 deletions.
7 changes: 5 additions & 2 deletions core/lib/src/models/tables/study.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,11 @@ class Study extends SupabaseObjectFunctions<Study>
static Future<ExtractionResult<Study>> publishedPublicStudies() async {
ExtractionResult<Study> result;
try {
final response =
await env.client.from(tableName).select().eq('participation', 'open').eq("is_closed", false);
final response = await env.client
.from(tableName)
.select()
.eq('participation', 'open')
.eq("is_closed", false);
final extracted = SupabaseQuery.extractSupabaseList<Study>(
List<Map<String, dynamic>>.from(response),
);
Expand Down
4 changes: 3 additions & 1 deletion core/lib/src/models/tables/study_subject.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ class StudySubject extends SupabaseObjectFunctions<StudySubject> {
Future<StudySubject> save({bool onlyUpdate = false}) async {
try {
final tableQuery = env.client.from(tableName);
final query = onlyUpdate ? tableQuery.update(toJson()).eq("id", id) : tableQuery.upsert(toJson());
final query = onlyUpdate
? tableQuery.update(toJson()).eq("id", id)
: tableQuery.upsert(toJson());
final response = await query.select();
final json = toFullJson(
partialJson: List<Map<String, dynamic>>.from(response).single,
Expand Down
26 changes: 13 additions & 13 deletions designer_v2/lib/common_views/action_popup_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ class ActionPopUpMenuButton extends StatelessWidget {
itemBuilder: (BuildContext context) {
final textTheme = theme.textTheme.labelMedium!;
final List<PopupMenuEntry> popupList = [];
for (final action in actions) {
if (action.isSeparator) {
popupList.add(const PopupMenuDivider());
continue;
}
popupList.add(PopupMenuItem(
value: action,
child: ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
for (final action in actions) {
if (action.isSeparator) {
popupList.add(const PopupMenuDivider());
continue;
}
popupList.add(PopupMenuItem(
value: action,
child: ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
horizontalTitleGap: 4.0,
leading: (action.icon == null)
? const SizedBox.shrink()
Expand All @@ -111,10 +111,10 @@ class ActionPopUpMenuButton extends StatelessWidget {
)
: Text(action.label, style: textTheme),
),
));
continue;
}
return popupList;
),);
continue;
}
return popupList;
},
);
}
Expand Down
9 changes: 4 additions & 5 deletions designer_v2/lib/features/recruit/study_recruit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class StudyRecruitScreen extends StudyPageWidget {
return BannerBox(
noPrefix: true,
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextParagraph(
Expand All @@ -75,8 +74,8 @@ class StudyRecruitScreen extends StudyPageWidget {
TextParagraph(
text: tr.banner_study_closed_description,
),
]),
style: BannerStyle.info);
],),
style: BannerStyle.info,);
}

return null;
Expand Down Expand Up @@ -106,12 +105,12 @@ class StudyRecruitScreen extends StudyPageWidget {
? null
: () {
final formViewModel =
ref.read(inviteCodeFormViewModelProvider(studyId));
ref.read(inviteCodeFormViewModelProvider(studyId));
showFormSideSheet<InviteCodeFormViewModel>(
context: context,
formViewModel: formViewModel,
formViewBuilder: (formViewModel) =>
InviteCodeFormView(formViewModel: formViewModel),
InviteCodeFormView(formViewModel: formViewModel),
);
},
);
Expand Down
1 change: 0 additions & 1 deletion designer_v2/lib/features/study/study_status_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class StudyStatusBadge extends StatelessWidget {

final tooltipMessage =
'${status?.description ?? ''}\n${(status == StudyStatus.closed ? null : participation?.description) ?? ''}'

.trim();

Widget inTooltip(Widget child) {
Expand Down
25 changes: 18 additions & 7 deletions designer_v2/lib/repositories/study_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,14 @@ class StudyRepository extends ModelRepository<Study>

Future<void> onCloseCallback() {
model.isClosed = true;
return save(model).then((value) => ref.read(routerProvider).dispatch(RoutingIntents.studies)).then((value) =>
Future.delayed(const Duration(milliseconds: 200),
() => ref.read(notificationServiceProvider).show(Notifications.studyClosed)));
return save(model)
.then((value) =>
ref.read(routerProvider).dispatch(RoutingIntents.studies),)
.then((value) => Future.delayed(
const Duration(milliseconds: 200),
() => ref
.read(notificationServiceProvider)
.show(Notifications.studyClosed),),);
}

final currentUser = authRepository.currentUser;
Expand Down Expand Up @@ -190,11 +195,17 @@ class StudyRepository extends ModelRepository<Study>
type: StudyActionType.close,
label: StudyActionType.close.string,
onExecute: () {
return ref.read(notificationServiceProvider).show(Notifications.studyCloseConfirmation, actions: [
NotificationAction(label: StudyActionType.close.string, onSelect: onCloseCallback, isDestructive: true),
]);
return ref
.read(notificationServiceProvider)
.show(Notifications.studyCloseConfirmation, actions: [
NotificationAction(
label: StudyActionType.close.string,
onSelect: onCloseCallback,
isDestructive: true,),
],);
},
isAvailable: model.canClose(currentUser) && model.status == StudyStatus.running,
isAvailable:
model.canClose(currentUser) && model.status == StudyStatus.running,
),
ModelAction(
type: StudyActionType.delete,
Expand Down
2 changes: 1 addition & 1 deletion designer_v2/lib/services/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Notifications {
title: tr.dialog_study_close_title,
message: tr.dialog_study_close_description,
icon: MdiIcons.accountLock,
actions: [NotificationDefaultActions.cancel]);
actions: [NotificationDefaultActions.cancel],);
}

class NotificationDefaultActions {
Expand Down

0 comments on commit 8dad7c3

Please sign in to comment.