Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redesign: Academic Path - Schedule #1445

Open
wants to merge 26 commits into
base: ui/redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aaa16ba
Started working on integrating a schedule tab into the academic path …
Granja5 Jan 18, 2025
91afb0d
Small Code Refactor
Granja5 Jan 18, 2025
a853981
Changed tabs to timeline (need to sync the current day to the default…
Granja5 Jan 18, 2025
8a4e915
Working on the Day Tab Visuals
Granja5 Jan 18, 2025
381096f
Tabs organized from Sunday to Saturday (still need to sync to the con…
Granja5 Jan 19, 2025
77e8c91
Tab day correctly associated to the corresponding week day content
Granja5 Jan 19, 2025
db2085d
Week day tab bar complete
Granja5 Jan 19, 2025
2f95f6c
Small visual changes to the tab bar
Granja5 Jan 20, 2025
8e27725
Merge branch 'ui/redesign' into redesign/schedule-page
Granja5 Jan 20, 2025
4891c3c
Adding the new Schedule Cards
Granja5 Jan 20, 2025
1fd369d
Card Timeline Mock
Granja5 Jan 21, 2025
8f178d1
Reformatted the Daily Cards Association and Created a Specific Timeli…
Granja5 Jan 21, 2025
007b0e1
Visually almost complete
Granja5 Jan 21, 2025
8652802
"No classes for the week" image added and tab bar now fits the screen
Granja5 Jan 21, 2025
70096c7
Page using Lecture Provider instead of Mock Lecture List
Granja5 Jan 21, 2025
5f57aa5
Refactored to use CardTimeline and added the schedule_timeline functi…
Granja5 Jan 21, 2025
60307bc
refactor: separated the page state, view and helper widget logics int…
Granja5 Jan 21, 2025
91ba9dc
Merge branch 'ui/redesign' into redesign/schedule-page
Granja5 Jan 30, 2025
5ac6615
fix: Timeline initial tab and initial content correctly and instantly…
Granja5 Jan 30, 2025
54ae46d
fix: timeline tab displays today's date correctly when there are no l…
Granja5 Jan 30, 2025
360bd52
fix: resolved the padding conflict between the general page extendBod…
Granja5 Feb 5, 2025
1a462f7
fix: updated themes and extended the timeline_bar for active lectures
Granja5 Feb 6, 2025
a9fed06
Added lecture name to the Lectures Model
Granja5 Feb 6, 2025
eacead4
Updated old parser api to remove error message
Granja5 Feb 6, 2025
c5efd06
remove tab widget
thePeras Feb 6, 2025
8cdad66
Refactored the code, added filtering of the week lectures to the mapp…
Granja5 Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class AppLecturesDatabase extends AppDatabase<List<Lecture>> {
createScript,
],
onUpgrade: migrate,
version: 10,
version: 11,
);
static const createScript = '''
CREATE TABLE lectures(subject TEXT, typeClass TEXT,
CREATE TABLE lectures(acronym TEXT, subject TEXT, typeClass TEXT,
startTime TEXT, endTime TEXT, room TEXT, teacher TEXT, classNumber TEXT, occurrId INTEGER)''';

/// Returns a list containing all of the lectures stored in this database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Future<List<Lecture>> parseSchedule(
final occurrId = lecture['ocorrencia_id'] as int;

final lec = Lecture.fromApi(
'',
subject,
typeClass,
startTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ part '../../../../../generated/controller/parsers/schedule/new_api/models/respon

@JsonSerializable(explicitToJson: true)
class ResponseLectureUnit {
ResponseLectureUnit(this.acronym, this.sigarraId);
ResponseLectureUnit(this.acronym, this.name, this.sigarraId);
factory ResponseLectureUnit.fromJson(Map<String, dynamic> json) =>
_$ResponseLectureUnitFromJson(json);

String acronym;
String name;
@JsonKey(name: 'sigarra_id')
int sigarraId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ List<Lecture> getLecturesFromApiResponse(
.map(
(lecture) => Lecture(
lecture.units.first.acronym,
lecture.units.first.name,
lecture.typology.acronym,
lecture.start,
lecture.end,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions packages/uni_app/lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
Expand All @@ -20,8 +21,8 @@ import 'messages_pt_PT.dart' as messages_pt_pt;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null),
'pt_PT': () => new Future.value(null),
'en': () => new SynchronousFuture(null),
'pt_PT': () => new SynchronousFuture(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
Expand All @@ -36,18 +37,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
return new SynchronousFuture(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib());
lib == null ? new SynchronousFuture(false) : lib();
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true);
return new SynchronousFuture(true);
}

bool _messagesExistFor(String locale) {
Expand Down
15 changes: 9 additions & 6 deletions packages/uni_app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -19,12 +20,12 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';

static m0(time) => "last refresh at ${time}";
static String m0(time) => "last refresh at ${time}";

static m1(time) =>
static String m1(time) =>
"${Intl.plural(time, zero: 'Refreshed ${time} minutes ago', one: 'Refreshed ${time} minute ago', other: 'Refreshed ${time} minutes ago')}";

static m2(title) => "${Intl.select(title, {
static String m2(title) => "${Intl.select(title, {
'horario': 'Schedule',
'exames': 'Exams',
'area': 'Personal Area',
Expand All @@ -41,7 +42,7 @@ class MessageLookup extends MessageLookupByLibrary {
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function>{
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("About us"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Academic services"),
Expand Down Expand Up @@ -161,7 +162,6 @@ class MessageLookup extends MessageLookupByLibrary {
"language": MessageLookupByLibrary.simpleMessage("Language"),
"last_refresh_time": m0,
"last_timestamp": m1,
"lectures": MessageLookupByLibrary.simpleMessage("Lectures"),
"library_occupation":
MessageLookupByLibrary.simpleMessage("Library Occupation"),
"load_error": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -194,6 +194,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("You don\'t have classes on"),
"no_classes_on_weekend":
MessageLookupByLibrary.simpleMessage("You don\'t have classes on"),
"no_classes_this_week": MessageLookupByLibrary.simpleMessage(
"You have no classes this week"),
"no_college": MessageLookupByLibrary.simpleMessage("no college"),
"no_course_units": MessageLookupByLibrary.simpleMessage(
"No course units in the selected period"),
Expand Down Expand Up @@ -270,6 +272,7 @@ class MessageLookup extends MessageLookupByLibrary {
"restaurant_main_page": MessageLookupByLibrary.simpleMessage(
"Do you want to see your favorite restaurants in the main page?"),
"room": MessageLookupByLibrary.simpleMessage("Room"),
"schedule": MessageLookupByLibrary.simpleMessage("Schedule"),
"school_calendar":
MessageLookupByLibrary.simpleMessage("School Calendar"),
"search": MessageLookupByLibrary.simpleMessage("Search"),
Expand Down
13 changes: 7 additions & 6 deletions packages/uni_app/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -19,12 +20,12 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'pt_PT';

static m0(time) => "última atualização às ${time}";
static String m0(time) => "última atualização às ${time}";

static m1(time) =>
static String m1(time) =>
"${Intl.plural(time, zero: 'Atualizado há ${time} minutos', one: 'Atualizado há ${time} minuto', other: 'Atualizado há ${time} minutos')}";

static m2(title) => "${Intl.select(title, {
static String m2(title) => "${Intl.select(title, {
'horario': 'Horário',
'exames': 'Exames',
'area': 'Área Pessoal',
Expand All @@ -41,7 +42,7 @@ class MessageLookup extends MessageLookupByLibrary {
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function>{
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("Sobre nós"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Serviços académicos"),
Expand Down Expand Up @@ -160,7 +161,6 @@ class MessageLookup extends MessageLookupByLibrary {
"language": MessageLookupByLibrary.simpleMessage("Idioma"),
"last_refresh_time": m0,
"last_timestamp": m1,
"lectures": MessageLookupByLibrary.simpleMessage("Aulas"),
"library_occupation":
MessageLookupByLibrary.simpleMessage("Ocupação da Biblioteca"),
"load_error": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -271,6 +271,7 @@ class MessageLookup extends MessageLookupByLibrary {
"restaurant_main_page": MessageLookupByLibrary.simpleMessage(
"Queres ver os teus restaurantes favoritos na página principal?"),
"room": MessageLookupByLibrary.simpleMessage("Sala"),
"schedule": MessageLookupByLibrary.simpleMessage("Aulas"),
"school_calendar":
MessageLookupByLibrary.simpleMessage("Calendário Escolar"),
"search": MessageLookupByLibrary.simpleMessage("Pesquisar"),
Expand Down
20 changes: 15 additions & 5 deletions packages/uni_app/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/uni_app/lib/generated/model/entities/lecture.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/uni_app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
"@no_bus_stops": {},
"no_class": "There are no classes to display",
"@no_class": {},
"no_classes_this_week": "You have no classes this week",
"@no_classes_this_week": {},
"no_classes": "No classes to present",
"@no_classes": {},
"no_classes_on": "You don't have classes on",
Expand Down Expand Up @@ -342,8 +344,8 @@
"@wrong_credentials_exception": {},
"internet_status_exception": "Check your internet connection",
"@internet_status_exception": {},
"lectures": "Lectures",
"@lectures": {},
"schedule": "Schedule",
"@schedule": {},
"exams": "Exams",
"@exams": {},
"courses": "Courses",
Expand Down
4 changes: 2 additions & 2 deletions packages/uni_app/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@
"@wrong_credentials_exception": {},
"internet_status_exception": "Verifique sua conexão com a internet",
"@internet_status_exception": {},
"lectures": "Aulas",
"@lectures": {},
"schedule": "Aulas",
"@schedule": {},
"exams": "Exames",
"@exams": {},
"courses": "Cursos",
Expand Down
39 changes: 7 additions & 32 deletions packages/uni_app/lib/model/entities/lecture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ part '../../generated/model/entities/lecture.g.dart';
class Lecture {
/// Creates an instance of the class [Lecture].
Lecture(
this.acronym,
this.subject,
this.typeClass,
this.startTime,
Expand All @@ -23,6 +24,7 @@ class Lecture {
_$LectureFromJson(json);

factory Lecture.fromApi(
String acronym,
String subject,
String typeClass,
DateTime startTime,
Expand All @@ -34,6 +36,7 @@ class Lecture {
) {
final endTime = startTime.add(Duration(minutes: 30 * blocks));
final lecture = Lecture(
acronym,
subject,
typeClass,
startTime,
Expand All @@ -46,37 +49,7 @@ class Lecture {
return lecture;
}

factory Lecture.fromHtml(
String subject,
String typeClass,
DateTime day,
String startTimeString,
int blocks,
String room,
String teacher,
String classNumber,
int occurrId,
) {
final startTimeList = startTimeString.split(':');
final startTime = day.add(
Duration(
hours: int.parse(startTimeList[0]),
minutes: int.parse(startTimeList[1]),
),
);
final endTime = startTime.add(Duration(minutes: 30 * blocks));
return Lecture(
subject,
typeClass,
startTime,
endTime,
room,
teacher,
classNumber,
occurrId,
);
}

String acronym;
String subject;
String typeClass;
String room;
Expand All @@ -89,7 +62,7 @@ class Lecture {

@override
String toString() {
return '$subject $typeClass\n$startTime $endTime\n $room '
return '$acronym \n$subject $typeClass\n$startTime $endTime\n $room '
'$teacher\n';
}

Expand All @@ -100,6 +73,7 @@ class Lecture {

@override
int get hashCode => Object.hash(
acronym,
subject,
startTime,
endTime,
Expand All @@ -113,6 +87,7 @@ class Lecture {
@override
bool operator ==(Object other) =>
other is Lecture &&
acronym == other.acronym &&
subject == other.subject &&
startTime == other.startTime &&
endTime == other.endTime &&
Expand Down
Loading