Skip to content

Commit

Permalink
Merge pull request #153 from sparcs-kaist/feat@popup-redesign
Browse files Browse the repository at this point in the history
Redesign Popup
  • Loading branch information
sboh1214 authored Sep 20, 2023
2 parents 72accc6 + 5924ff4 commit c6f0fc4
Show file tree
Hide file tree
Showing 43 changed files with 668 additions and 380 deletions.
13 changes: 13 additions & 0 deletions assets/icons/OTL.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/icons/addLecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/icons/alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/deleteLecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/icons/overlap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/icons/timetable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 23 additions & 8 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,20 @@
}
},
"timetable": {
"ask_delete_lecture": "Do you want to delete class '{}'?",
"ask_delete_tab": "Do you really want to delete '{}'?",
"my_tab": "My Table",
"tab": "Table {}",
"add_lecture": "Add Lecture",
"remove_lecture": "Remove Lecture",
"dialog": {
"add_lecture": "Add Lecture",
"ask_add_lecture": "There is a lecture with overlapping hours. If added, the previous lecture will be deleted.\nDo you want to add new lecture to the timetable?"
"add_overlapping_lecture": "Add Overlapping Lecture",
"delete_lecture": "Delete Lecture",
"delete_tab": "Delete Table",
"ask_add_lecture": "Do you want to add lecture '{lecture}'?",
"ask_add_lecture_with_tab": "Do you want to add lecture '{lecture}' to {timetable}?",
"ask_add_overlapping_lecture": "Time overlaps with {lectures}. If you add '{lecture}', the lecture(s) will be deleted. Do you want to add it to the timetable?",
"ask_add_overlapping_lecture_with_tab": "Time overlaps with {lectures} in {timetable}. If you add '{lecture}', the lecture(s) will be deleted. Do you want to add it to the timetable?",
"ask_delete_lecture": "Do you want to delete lecture '{lecture}'?",
"ask_delete_lecture_with_tab": "Do you want to delete lecture '{lecture}' from {timetable}?",
"ask_delete_tab": "Do you really want to delete {timetable}?"
},
"tab_menu": {
"copy": "Copy Timetable",
Expand Down Expand Up @@ -130,7 +135,12 @@
"speech": "Speech",
"like": "Like",
"report": "Report",
"expand": "more"
"expand": "more",
"mailto": {
"subject": "[Report Review]",
"body_reason": "[Reason for Reporting]\n*Please describe a reason for reporting.\n---------------------------------\n\n\n\n---------------------------------\n\n",
"body_info": "[Review Information]\n*This information has been filled automatically. Please do NOT edit.\nLecture: {title} ({oldCode})\nSemester: {semesterTitle}\nProf.: {professors}\nContent:\n{content}\n"
}
},
"user": {
"name": "Name",
Expand All @@ -154,10 +164,15 @@
"send_anonymously": "Send anonymously",
"send_anonymously_desc": "Not including user ID in error logs",
"reset_all": "Reset all settings",
"reset_all_desc": "Are you really want to reset all data except login data?",
"dialog": {
"reset": "Reset",
"reset_settings": "Reset settings",
"reset_settings_desc": "Are you really want to reset all data? However, it will be reset except for login data."
},
"throw_test": "Throw Test Exception",
"throw_test_desc": "for testing firebase crashlytics",
"about": "About"
"about": "About",
"view_licenses": "View Licenses"
},
"department": {
"department": "Dept.",
Expand Down
35 changes: 25 additions & 10 deletions assets/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"alert": "경고",
"cancel": "취소",
"delete": "삭제",
"add": "추가하기",
"add": "추가",
"reset": "초기화",
"reset_all": "전체 초기화",
"search": "검색",
Expand Down Expand Up @@ -65,15 +65,20 @@
}
},
"timetable": {
"ask_delete_lecture": "'{}' 수업을 삭제하시겠습니까?",
"ask_delete_tab": "'{}'을(를) 정말 삭제하시겠습니까?",
"my_tab": "내 시간표",
"tab": "시간표 {}",
"add_lecture": "시간표에 추가",
"remove_lecture": "시간표에서 제거",
"dialog": {
"add_lecture": "수업 추가",
"ask_add_lecture": "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?"
"add_overlapping_lecture": "겹치는 수업 추가",
"delete_lecture": "수업 삭제",
"delete_tab": "시간표 삭제",
"ask_add_lecture": "'{lecture}' 수업을 추가하시겠습니까?",
"ask_add_lecture_with_tab": "'{lecture}' 수업을 {timetable}에 추가하시겠습니까?",
"ask_add_overlapping_lecture": "{lectures}와(과) 시간이 겹칩니다. '{lecture}'을(를) 추가하시면 해당 수업은 삭제됩니다. 시간표에 추가하시겠습니까?",
"ask_add_overlapping_lecture_with_tab": "{timetable}의 {lectures}와(과) 시간이 겹칩니다. '{lecture}'을(를) 추가하시면 해당 수업은 삭제됩니다. 시간표에 추가하시겠습니까?",
"ask_delete_lecture": "'{lecture}' 수업을 삭제하시겠습니까?",
"ask_delete_lecture_with_tab": "'{lecture}' 수업을 {timetable}에서 삭제하시겠습니까?",
"ask_delete_tab": "{timetable}을(를) 정말 삭제하시겠습니까?"
},
"tab_menu": {
"copy": "시간표 복제하기",
Expand Down Expand Up @@ -130,7 +135,12 @@
"speech": "강의",
"like": "추천",
"report": "신고하기",
"expand": "더 보기"
"expand": "더 보기",
"mailto": {
"subject": "[후기 신고]",
"body_reason": "[신고 사유]\n*후기를 신고한 이유를 서술해 주세요.\n---------------------------------\n\n\n\n---------------------------------\n\n",
"body_info": "[신고할 후기 정보]\n*자동으로 작성된 후기 정보입니다. 원활한 신고를 위해서 수정하지 말아주세요.\n과목: {title} ({oldCode})\n학기: {semesterTitle}\n교수: {professors}\n내용:\n{content}\n"
}
},
"user": {
"name": "이름",
Expand All @@ -142,7 +152,7 @@
"logout": "로그아웃",
"delete_account": "계정 삭제",
"ask_delete_account": "계정을 정말 삭제하시겠습니까?",
"account_deleted": "계정 삭제됨",
"account_deleted": "삭제된 계정",
"deleted_account": "삭제된 계정입니다."
},
"settings": {
Expand All @@ -154,10 +164,15 @@
"send_anonymously": "익명으로 전송",
"send_anonymously_desc": "오류 로그에 사용자 ID를 포함하지 않고 익명으로 전송합니다.",
"reset_all": "모든 설정 데이터 초기화",
"reset_all_desc": "정말 모든 설정 데이터를 초기화하시겠습니까? 로그인 정보는 초기화되지 않습니다.",
"dialog": {
"reset": "초기화",
"reset_settings": "설정 초기화",
"reset_settings_desc": "정말 모든 설정 데이터를 초기화하시겠습니까? 단, 로그인 정보는 제외하고 초기화됩니다."
},
"throw_test": "테스트 오류 발생",
"throw_test_desc": "Firebase crashlytics 테스트용",
"about": "정보"
"about": "정보",
"view_licenses": "라이선스 보기"
},
"department": {
"department": "학과",
Expand Down
1 change: 1 addition & 0 deletions lib/constants/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class OTLColor {
static const grayD = Color(0xFFDDDDDD);
static const grayE = Color(0xFFEEEEEE);
static const grayF = Color(0xFFFFFFFF);
static const barrier = Color(0x40000000);

static const pinksLight = Color(0xFFF9F0F0);
static const pinksSub = Color(0xFFF6C5CD);
Expand Down
18 changes: 4 additions & 14 deletions lib/constants/text_styles.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'package:flutter/material.dart';

const regularBase = TextStyle(letterSpacing: 0.15);
const regularBase = TextStyle(
letterSpacing: 0.15,
leadingDistribution: TextLeadingDistribution.even,
);

final labelRegular = regularBase.copyWith(
fontSize: 12.0,
Expand Down Expand Up @@ -31,16 +34,3 @@ final displayRegular = regularBase.copyWith(
height: 1.6,
);
final displayBold = displayRegular.copyWith(fontWeight: FontWeight.bold);

final evenLabelRegular = labelRegular.copyWith(
leadingDistribution: TextLeadingDistribution.even,
);
final evenBodyRegular = bodyRegular.copyWith(
leadingDistribution: TextLeadingDistribution.even,
);
final evenBodyBold = bodyBold.copyWith(
leadingDistribution: TextLeadingDistribution.even,
);
final evenTitleBold = titleBold.copyWith(
leadingDistribution: TextLeadingDistribution.even,
);
2 changes: 2 additions & 0 deletions lib/constants/url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ const API_LIKED_REVIEW_URL = API_URL + "/users/{user_id}/liked-reviews";
const API_SHARE_URL = API_URL + "share/timetable/{share_type}";

enum ShareType { image, ical }

const CONTACT = "otlplus@sparcs.org";
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class OTLFirebaseApp extends StatelessWidget {
final base = ThemeData(
fontFamily: 'NotoSansKR',
primarySwatch: createMaterialColor(OTLColor.pinksMain),
canvasColor: Colors.white,
canvasColor: OTLColor.grayF,
iconTheme: const IconThemeData(color: OTLColor.gray3),
inputDecorationTheme: const InputDecorationTheme(
border: InputBorder.none,
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/course_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class CourseDetailPage extends StatelessWidget {
: (isEn
? (professor.nameEn == '' ? professor.name : professor.nameEn)
: professor.name),
style: evenLabelRegular,
style: labelRegular,
),
selected: (professor == null
? selectedFilter == "ALL"
Expand Down
66 changes: 41 additions & 25 deletions lib/pages/lecture_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_web_browser/flutter_web_browser.dart';
import 'package:otlplus/constants/text_styles.dart';
import 'package:otlplus/extensions/semester.dart';
import 'package:otlplus/models/review.dart';
import 'package:otlplus/pages/course_detail_page.dart';
import 'package:otlplus/widgets/otl_dialog.dart';
import 'package:otlplus/widgets/responsive_button.dart';
import 'package:otlplus/utils/navigator.dart';
import 'package:otlplus/widgets/otl_scaffold.dart';
Expand Down Expand Up @@ -98,41 +100,55 @@ class LectureDetailPage extends StatelessWidget {
padding: const EdgeInsets.all(16),
onTap: () {
final timetableModel = context.read<TimetableModel>();
final isKo = context.locale == Locale('ko');
final lectureTitle = isKo ? lecture.title : lecture.titleEn;
final timetable =
'${timetableModel.selectedSemester.title} ${'timetable.tab'.tr(
args: [timetableModel.selectedIndex.toString()],
)}';

if (isAdded) {
timetableModel.removeLecture(lecture: lecture);
OTLNavigator.pushDialog(
context: context,
builder: (_) => OTLDialog(
type: OTLDialogType.deleteLectureWithTab,
namedArgs: {'lecture': lectureTitle, 'timetable': timetable},
onTapPos: () => timetableModel.removeLecture(lecture: lecture),
),
);
} else {
timetableModel.addLecture(
lecture: lecture,
noOverlap: () async {
bool result = false;

await OTLNavigator.pushDialog(
context: context,
builder: (_) => OTLDialog(
type: OTLDialogType.addLectureWithTab,
namedArgs: {'lecture': lectureTitle, 'timetable': timetable},
onTapPos: () => result = true,
),
);

return result;
},
onOverlap: (lectures) async {
bool result = false;

await OTLNavigator.pushDialog(
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
title: Text("timetable.dialog.add_lecture".tr()),
content: Text("timetable.dialog.ask_add_lecture".tr()),
actions: [
IconTextButton(
padding: EdgeInsets.all(12),
text: 'common.cancel'.tr(),
color: OTLColor.pinksMain,
onTap: () {
result = false;
OTLNavigator.pop(context);
},
),
IconTextButton(
padding: EdgeInsets.all(12),
text: 'common.add'.tr(),
color: OTLColor.pinksMain,
onTap: () {
result = true;
OTLNavigator.pop(context);
},
),
],
builder: (_) => OTLDialog(
type: OTLDialogType.addOverlappingLectureWithTab,
namedArgs: {
'lectures': lectures
.map((lecture) =>
"'${isKo ? lecture.title : lecture.titleEn}'")
.join(', '),
'lecture': lectureTitle,
'timetable': timetable
},
onTapPos: () => result = true,
),
);

Expand Down
3 changes: 2 additions & 1 deletion lib/pages/liked_review_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:otlplus/constants/color.dart';
import 'package:otlplus/constants/text_styles.dart';
import 'package:otlplus/pages/course_detail_page.dart';
import 'package:otlplus/providers/course_detail_model.dart';
Expand Down Expand Up @@ -86,7 +87,7 @@ class LikedReviewPage extends StatelessWidget {
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.black12,
color: OTLColor.grayE,
strokeWidth: 2,
),
),
Expand Down
23 changes: 6 additions & 17 deletions lib/pages/login_page.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'dart:io';

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:otlplus/constants/color.dart';
import 'package:otlplus/widgets/responsive_button.dart';
import 'package:otlplus/utils/navigator.dart';
import 'package:otlplus/widgets/otl_dialog.dart';
import 'package:otlplus/widgets/otl_scaffold.dart';
import 'package:provider/provider.dart';
import 'package:otlplus/providers/auth_model.dart';
Expand All @@ -29,21 +28,11 @@ class _LoginPageState extends State<LoginPage> {
(_) async {
if (!((await SharedPreferences.getInstance()).getBool('hasAccount') ??
true)) {
await showDialog(
OTLNavigator.pushDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('user.account_deleted'.tr()),
content: Text('user.deleted_account'.tr()),
actions: [
IconTextButton(
padding: EdgeInsets.all(12),
text: 'common.close'.tr(),
color: OTLColor.pinksMain,
onTap: () {
SystemNavigator.pop();
},
),
],
builder: (_) => OTLDialog(
type: OTLDialogType.accountDeleted,
onTapNeg: () => SystemNavigator.pop(),
),
);
}
Expand Down
Loading

0 comments on commit c6f0fc4

Please sign in to comment.