Skip to content

Add support for Piefed events.#384

Open
olorin99 wants to merge 4 commits intomainfrom
events
Open

Add support for Piefed events.#384
olorin99 wants to merge 4 commits intomainfrom
events

Conversation

@olorin99
Copy link
Contributor

Adds support for viewing and creating events.

There are several constraints for creating an event and parts of the UI are highlighted when these constraints aren't met.

  • Start date/time should be after the current date/time.
  • End date/time should be after the start date/time.
  • If online event is checked a link should be included.

Viewing a event.

Screenshot from 2026-03-23 13-58-49

Creating an event.

Screenshot from 2026-03-23 14-01-16

With end date before start date.

Screenshot from 2026-03-23 14-12-55

@olorin99 olorin99 requested a review from jwr1 March 23, 2026 04:21
Copy link
Member

@jwr1 jwr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to review; I've been busy this semester. Anyway, it looks pretty good!

);
onSelect(pickedDate);
},
child: Text(date != null ? dateOnlyFormat(date) : 'Unset'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A localized string is needed here.

Actually, if both _startDate and _endDate are initialized to Date.now(), is date here even ever equal to null?

"eventMode_invite": "Invite",
"eventOnline": "Online Event",
"eventAddEnd": "Add end date",
"eventError_start": "The start date/time is required to be after the current date/time.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"eventError_start": "The start date/time is required to be after the current date/time.",
"eventError_start": "The start date/time must be in the future.",

For clarity.

"eventOnline": "Online Event",
"eventAddEnd": "Add end date",
"eventError_start": "The start date/time is required to be after the current date/time.",
"eventError_end": "The end date/time is required to be before the start date/time.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"eventError_end": "The end date/time is required to be before the start date/time.",
"eventError_end": "The end date/time must be after the start.",

Comment on lines +552 to +556
case ServerSoftware.mbin:
throw UnimplementedError('Polls are unsupported on mbin');

case ServerSoftware.lemmy:
throw UnimplementedError('Polls are unsupported on lemmy');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case ServerSoftware.mbin:
throw UnimplementedError('Polls are unsupported on mbin');
case ServerSoftware.lemmy:
throw UnimplementedError('Polls are unsupported on lemmy');
case ServerSoftware.mbin:
throw UnimplementedError('Events are unsupported on mbin');
case ServerSoftware.lemmy:
throw UnimplementedError('Events are unsupported on lemmy');

Comment on lines +329 to +333
var pickedDate = await showDatePicker(
context: context,
firstDate: DateTime.now(),
lastDate: DateTime.now().add(const Duration(days: 365 * 10)),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we pass in initialDate, then when editing the date, it will be preselected with whatever the previous value was. That should make editing the date more than once easier.

Comment on lines +339 to +342
final pickedTime = await showTimePicker(
context: context,
initialTime: const TimeOfDay(hour: 0, minute: 0),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for initialTime and having it preselected to the current value.

Comment on lines 44 to 73
@@ -61,12 +62,12 @@ String dateDiffFormat(DateTime input) {
}

final hours = difference.inHours;
if (hours > 0) {
if (hours.abs() > 0) {
return '${hours}h';
}

final minutes = difference.inMinutes;
if (minutes > 0) {
if (minutes.abs() > 0) {
return '${minutes}m';
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the abs() here for? Are we expecting end to ever be before start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants