Skip to content

Commit

Permalink
Final Milestone Frotend (#715)
Browse files Browse the repository at this point in the history
* workspace provider is updated

* Connect provider to workspace page2 (#591)

* mobile workspace connected to backend

* add/edit/delete entries

* add/delete references

* edit workspace title

* provider and box implementations

* add route for q/a and reply button

* remove comment

* make questionlist stateful and fix provider bugs

* change nodeid to questionid in answerbox

* questions in state fix

* Connect provider to workspace page2 (#601)

* mobile workspace connected to backend

* add/edit/delete entries

* add/delete references

* edit workspace title

* send collaboration request

* new features

* workspace enhancement

* create new workspace button is added

* fixed web preview mode problem

* message in collaboration request

* semantic tag mock

* mock semantic tags in workspace

* userType and review workspaces

* fix the base. Changed base to frontend

* fix wrong base. Changed base to frontend

* send workspace to review

* add review button

* button to the node details page

* add contributor control

* Create annotation provider and model

* Update annotation text widget

* Implement annotation widget to various pages

* buttons implemented except q/a

* Updated basic user model and wrote provider for basic user API

* answer questions bugs and refresh

* usertype connected to backend

* Make texts unselectable (#633)

* bug fix on guest user on profile view

* show unanswered questions to only contributors

* fixed editentry provider, resized some widgets

* create workspace from node

* implemented admin provider, in process connecting node details to backend

* resolved new conflicts with frontend branch

* code review

* bug fix

* bug fix

* user permissions on workspace

* update review request

* 646 fe home page advanced nodes (#677)

* New provider for getting nodes by type

* Create node options menu buttons

* Add buttons to home page

* 675 fe share button change app url (#678)

* Fix node details page width issue in large screens

* Add link to share button

* Change name graph to relation (#680)

* Remove notification page (#681)

* Fix view error for smaller screens (#683)

* Get related nodes to the given node

* Fix auth token disappears error (#685)

* Add flutter local storage shared preferences

* Save token to local storage, check if it is valid

* Check if user is already logged in while loading the app

* bug fix for showing multiple proofs (#686)

* bug fix for showing multiple proofs

* Change the complete layout to fix the bug

---------

Co-authored-by: Omer <[email protected]>

* update collaboration request

* user type update (#695)

* bug fix (#694)

* Error should affect only current index

* bug fixed in settings

* entry menu is added

* delete button deleted

* Display review comments (#707)

* review comments

* comments sidebar

* update contributors section's visibility (#708)

* disproof is added

* bug fix

* Code capitalize string extension

* Add semantic tag box to node view page and navigate to related tags on click

* Privacy policy is added (#718)

* Workspace (#698)

* more code

* more code

* connected to backend as much as possible

* no result message

* after the tag is added, the page refreshes

* delete semantic tag is active

* profile page semantic tag

* conflicts resolved

* Fe reset workspace button (#717)

* reset workspace button

* pending field

* pending

* bug fix

* bug fix

* conflicts resolved

* Admin features frontend (#716)

* Node model changed. Admin node hide feature completed. Admin provider fixed.

* Profile admin features connected to the backend

* minor fix

* fix promote/demote reviewer

* added hide button to questions

* is hidden

* models updated, bug fixed

* fix state updates hide or show buttons

* small fix in provider & ban button

* fix answer question bug.

* fix admin hide/show button

* answer question bug fix

* empty auth

---------

Co-authored-by: brunettow <[email protected]>

* Delete semantic tag file

* Fix errors related to merged changes in frontend

* Fix error related to previous merge

* user tags are completed (#723)

* orcid input field implemented & provider implemented (#722)

* Provider for GET and POST annotations (#688)

* Provider for GET and POST annotations

* change query parameter logic in annotation provider

* use annotion providers in annotation mechanism of frontend

* fix annotation provider

* add annotation mechanism and provider

* change request structure of add annotation

* Add author and disable not logged in user add annotation

* separate private and public annotations

* add change annotation feature

---------

Co-authored-by: Omer <[email protected]>

* add user null control for guest user (#724)

---------

Co-authored-by: Zulalm <[email protected]>
Co-authored-by: Mehmet Süzer <[email protected]>
Co-authored-by: Zulalm <[email protected]>
Co-authored-by: defabdullah <[email protected]>
Co-authored-by: mehmetSuzer <[email protected]>
Co-authored-by: brunettow <[email protected]>
Co-authored-by: Bengisu Takkin <[email protected]>
Co-authored-by: laylaylo <[email protected]>
Co-authored-by: defabdullah <[email protected]>
  • Loading branch information
10 people authored Dec 25, 2023
1 parent 88edcce commit d000984
Show file tree
Hide file tree
Showing 103 changed files with 8,399 additions and 2,369 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PODS:
- FlutterMacOS
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
Expand All @@ -14,6 +17,7 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

Expand All @@ -24,6 +28,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
Expand All @@ -33,6 +39,7 @@ SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PostQuestionError implements Exception {
String message;
PostQuestionError({this.message = "Post Question Error"});
}

class PostAnswerError implements Exception {
String message;
PostAnswerError({this.message = "Post Answer Error"});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extension StringExtension on String {
String capitalize() {
return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class SelectButtonsHelper {
static int selectedIndex = 0;
}
82 changes: 41 additions & 41 deletions project/FrontEnd/collaborative_science_platform/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import 'package:collaborative_science_platform/providers/admin_provider.dart';
import 'package:collaborative_science_platform/providers/annotation_provider.dart';
import 'package:collaborative_science_platform/providers/auth.dart';
import 'package:collaborative_science_platform/providers/profile_data_provider.dart';
import 'package:collaborative_science_platform/providers/node_provider.dart';
import 'package:collaborative_science_platform/providers/question_provider.dart';
import 'package:collaborative_science_platform/providers/settings_provider.dart';
import 'package:collaborative_science_platform/providers/user_provider.dart';
import 'package:collaborative_science_platform/providers/wiki_data_provider.dart';
import 'package:collaborative_science_platform/providers/workspace_provider.dart';
import 'package:collaborative_science_platform/services/screen_navigation.dart';
import 'package:collaborative_science_platform/utils/constants.dart';
Expand All @@ -12,9 +17,9 @@ import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:provider/provider.dart';

void main() {
void main() async {
configureApp();
runApp(const MyApp());
runApp(ChangeNotifierProvider.value(value: Auth(), child: const MyApp()));
}

void configureApp() {
Expand All @@ -25,55 +30,50 @@ void configureApp() {

class MyApp extends StatelessWidget {
const MyApp({super.key});

Future<void> checkTokenAndLogin(BuildContext context) async {
final auth = Provider.of<Auth>(context, listen: false);
await auth.checkTokenAndLogin();
}

@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider<Auth>(create: (context) => Auth()),
ChangeNotifierProvider<ScreenNavigation>(create: (context) => ScreenNavigation()),
ChangeNotifierProvider<ProfileDataProvider>(create: (context) => ProfileDataProvider()),
ChangeNotifierProvider<NodeProvider>(create: (context) => NodeProvider()),
ChangeNotifierProvider<UserProvider>(create: (context) => UserProvider()),
ChangeNotifierProvider<WorkspaceProvider>(create: (context) => WorkspaceProvider()),
ChangeNotifierProvider<QuestionAnswerProvider>(
create: (context) => QuestionAnswerProvider()),
ChangeNotifierProvider<AnnotationProvider>(create: (context) => AnnotationProvider()),
ChangeNotifierProvider<WikiDataProvider>(create: (context) => WikiDataProvider()),
ChangeNotifierProvider<AdminProvider>(create: (context) => AdminProvider()),
ChangeNotifierProvider<SettingsProvider>(create: (context) => SettingsProvider()),
],
// child: MaterialApp(
// debugShowCheckedModeBanner: false,
// title: Constants.appName,
// routes: {
// '/': (context) => const HomePage(),
// LoginPage.routeName: (context) => const LoginPage(),
// SignUpPage.routeName: (context) => const SignUpPage(),
// WorkspacesPage.routeName: (context) => const WorkspacesPage(),
//
// ///ProfilePage.routeName: (context) => const ProfilePage(),
// GraphPage.routeName: (context) => const GraphPage(),
// NotificationPage.routeName: (context) => const NotificationPage(),
// AccountSettingsPage.routeName: (context) => const AccountSettingsPage(),
// PleaseLoginPage2.routeName: (context) => const PleaseLoginPage2(),
// NodeDetailsPage.routeName: (context) {
// final int nodeId = ModalRoute.of(context)!.settings.arguments as int;
// return NodeDetailsPage(nodeID: nodeId);
// },
// ProfilePage.routeName: (context) {
// final String email = ModalRoute.of(context)!.settings.arguments as String ?? "";
// return ProfilePage(email: email);
// },
// },
// navigatorKey: ScreenNavigation.navigatorKey,
// theme: ThemeData(
// colorScheme: ColorScheme.fromSeed(seedColor: AppColors.primaryColor),
// useMaterial3: true,
// ),
child: Portal(
child: MaterialApp.router(
routerConfig: router,
debugShowCheckedModeBanner: false,
title: Constants.appName,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 85, 234, 145)),
useMaterial3: true,
),
),
child: FutureBuilder(
future: checkTokenAndLogin(context),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Portal(
child: MaterialApp.router(
routerConfig: router,
debugShowCheckedModeBanner: false,
title: Constants.appName,
theme: ThemeData(
colorScheme:
ColorScheme.fromSeed(seedColor: const Color.fromARGB(255, 85, 234, 145)),
useMaterial3: true,
),
),
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import 'package:collaborative_science_platform/models/basic_user.dart';

class Annotation {
int annotationID;
String annotationType;
String annotationVisibilityType;
BasicUser owner;
Object annotationLocation;
int? annotationID;
// String annotationType;
// String annotationVisibilityType;
// BasicUser owner;
// Object annotationLocation;
String annotationContent;
String annotationAuthor;
String
sourceLocation; // ${Constants.appUrl}/node/{nodeId}%23{theorem|proof}%23{theoremId|proofId}
int startOffset;
int endOffset;
DateTime createdAt;
DateTime updatedAt;
DateTime dateCreated;

Annotation({
required this.annotationID,
required this.annotationType,
required this.annotationVisibilityType,
required this.owner,
required this.annotationLocation,
this.annotationID,
required this.startOffset,
required this.endOffset,
required this.createdAt,
required this.updatedAt,
required this.annotationContent,
required this.annotationAuthor,
required this.sourceLocation,
required this.dateCreated,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ class BasicUser {
String bio;
bool emailNotificationPreference;
bool showActivity;
String userType;

BasicUser({
required this.basicUserId,
required this.bio,
required this.emailNotificationPreference,
required this.showActivity,
this.basicUserId = 0,
this.bio = "",
this.emailNotificationPreference = true,
this.showActivity = true,
this.userType = "",
});
factory BasicUser.fromJson(Map<String, dynamic> jsonString) {
return BasicUser(
basicUserId: jsonString["basic_user_id"],
bio: jsonString["bio"],
emailNotificationPreference: jsonString["email_notification_preference"],
showActivity: jsonString["show_activity_preference"],
userType: jsonString["user_type"],
);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:collaborative_science_platform/models/node.dart';
import 'package:collaborative_science_platform/models/node_details_page/proof.dart';
import 'package:collaborative_science_platform/models/node_details_page/question.dart';
import 'package:collaborative_science_platform/models/semantic_tag.dart';
import 'package:collaborative_science_platform/models/theorem.dart';
import 'package:collaborative_science_platform/models/user.dart';

Expand All @@ -16,8 +17,10 @@ class NodeDetailed {
List<User> reviewers;
List<Node> references;
List<Node> citations;
List<SemanticTag> semanticTags;
bool isValid;
int noVisits;
bool isHidden;
List<Question> questions;

//List<SemanticTag> semanticTags;
Expand All @@ -37,6 +40,8 @@ class NodeDetailed {
this.isValid = true,
this.noVisits = 0,
this.questions = const [],
this.semanticTags = const [],
this.isHidden = false,
//required this.semanticTags,
//required this.wikiTags,
//required this.annotations,
Expand All @@ -55,17 +60,21 @@ class NodeDetailed {
var proofsList = jsonString['proofs'] as List;
var theorem = Theorem.fromJson(jsonString['theorem']);
var questionsList = jsonString['question_set'] as List;
var semanticTagsList = jsonString['semantic_tags'] as List;
List<Node> references = referencesList.map((e) => Node.fromJsonforNodeDetailPage(e)).toList();
List<Node> citations = citationsList.map((e) => Node.fromJsonforNodeDetailPage(e)).toList();
List<User> contributors =
contributorsList.map((e) => User.fromJsonforNodeDetailPage(e)).toList();
//List<User> reviewers = reviewersList.map((e) => User.fromJsonforNodeDetailPage(e)).toList();
List<Proof> proof = proofsList.map((e) => Proof.fromJson(e)).toList();
List<Question> questions = questionsList.map((e) => Question.fromJson(e)).toList();
List<SemanticTag> semanticTags =
semanticTagsList.map((e) => SemanticTag.fromJsonforNodeDetailPage(e)).toList();
return NodeDetailed(
citations: citations,
contributors: contributors,
isValid: jsonString['is_valid'],
isHidden: jsonString['removed_by_admin'],
nodeId: jsonString['node_id'],
nodeTitle: jsonString['node_title'],
noVisits: jsonString['num_visits'],
Expand All @@ -74,6 +83,7 @@ class NodeDetailed {
questions: questions,
references: references,
//reviewers: reviewers,
semanticTags: semanticTags,
theorem: theorem,
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,68 @@
import 'package:collaborative_science_platform/models/user.dart';

class Question {
int id;
String content;
String createdAt;
User? asker;
String answer;
User asker;
String? answer;
User? answerer;
String answeredAt;
Question({
required this.content,
required this.createdAt,
required this.answer,
required this.answeredAt,
required this.answerer,
required this.asker,
});
String? answeredAt;
int? nodeId;
bool isAnswered;
bool isHidden;
Question(
{required this.id,
required this.content,
required this.createdAt,
required this.asker,
required this.answer,
required this.answerer,
required this.answeredAt,
required this.nodeId,
required this.isAnswered,
required this.isHidden});
factory Question.fromJson(Map<String, dynamic> jsonString) {
return Question(
id: jsonString['id'] ?? -1,
content: jsonString['question_content'] ?? "",
createdAt: jsonString['created_at'] ?? "",
answer: jsonString['answer_content'] ?? "",
answeredAt: jsonString['answered_at'] ?? "",
answerer: jsonString['answerer'] == null
? null
: User.fromJsonforNodeDetailPage(jsonString['answerer']),
asker:
jsonString['asker'] == null ? null : User.fromJsonforNodeDetailPage(jsonString['asker']),
asker: User.fromJsonforNodeDetailPage(jsonString['asker']),
nodeId: jsonString['node_id'] ?? -1,
isAnswered: jsonString['answer_content'] != null,
isHidden: jsonString['removed_by_admin'] ?? false,
);
}

factory Question.fromJsonforProfilePage(Map<String, dynamic> jsonString) {
return Question(
id: jsonString['id'] ?? -1,
content: jsonString['question_content'] ?? "",
createdAt: jsonString['ask_date'] ?? "",
asker: User(
id: jsonString['asker_id'],
email: jsonString['asker_mail'],
firstName: jsonString['asker_name'],
lastName: jsonString['asker_surname'],
),
answer: jsonString.containsKey("answer_content") ? jsonString["answer_content"] : "",
answerer: jsonString.containsKey("answerer")
? User(
id: jsonString['answerer_id'],
email: jsonString['answerer_mail'],
firstName: jsonString['answerer_name'],
lastName: jsonString['answerer_surname'],
)
: null,
answeredAt: jsonString.containsKey("answer_date") ? jsonString["answer_date"] as String : "",
nodeId: jsonString['node_id'] ?? -1,
isAnswered: jsonString['is_answered'] == 1,
isHidden: jsonString['removed_by_admin'] ?? false,
);
}
}
Loading

0 comments on commit d000984

Please sign in to comment.