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

💄👽🍻(UI): Update to Search Query #168

Merged
merged 72 commits into from Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
6c360b6
💄 ✨ (UI):
MattReed-ZA Sep 27, 2022
47df76b
💄 (UI):
MattReed-ZA Sep 27, 2022
ed516fc
💄 (UI):
MattReed-ZA Sep 27, 2022
50c2bee
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
f428f55
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
edd5603
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
a73b866
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
a7bcede
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
d2de205
💄(UI):
MattReed-ZA Sep 27, 2022
8121a12
💄 (UI): Trying to fix styling
MattReed-ZA Sep 27, 2022
c37a2a3
💄 (UI):
MattReed-ZA Sep 27, 2022
12100cb
💄 (UI):
MattReed-ZA Sep 27, 2022
f879e6f
💄 (UI):
MattReed-ZA Sep 27, 2022
5969449
💄 (UI):
MattReed-ZA Sep 27, 2022
1e645f8
💄 (UI):
MattReed-ZA Sep 27, 2022
e7dec6a
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
2d8c8e7
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
8f9f479
💄 🐛 (UI):
MattReed-ZA Sep 27, 2022
f10770f
🚀 (FireBase):
MattReed-ZA Sep 27, 2022
b15b818
💄 (UI):
MattReed-ZA Sep 28, 2022
10d3eeb
🩺 💄 (UI):
MattReed-ZA Sep 28, 2022
1cf2a36
💄 ✨ (UI):
MattReed-ZA Sep 28, 2022
6f0010a
🔀 Merged Develop into Matthew
MattReed-ZA Sep 28, 2022
1e4d37b
🔀 Fixing merge conflict
MattReed-ZA Sep 28, 2022
2d86f96
💄 🐛 (UI):
MattReed-ZA Sep 28, 2022
0b58a5d
👽️ (UI):
MattReed-ZA Sep 28, 2022
edac833
💄 🐛 (UI):
MattReed-ZA Sep 28, 2022
f220835
Merge branch 'develop' of https://github.com/COS301-SE-2022/MathU-Sim…
MattReed-ZA Sep 28, 2022
3aa28b2
Merge branch 'develop' of https://github.com/COS301-SE-2022/MathU-Sim…
MattReed-ZA Sep 28, 2022
c94db12
👽️ (UI):
MattReed-ZA Sep 28, 2022
a24184b
👽️ (UI):
MattReed-ZA Sep 28, 2022
5ab84ac
👽️ (UI):
MattReed-ZA Sep 28, 2022
288d01c
🐛 (UI):
MattReed-ZA Sep 28, 2022
3d150d8
Merge branch 'develop' of https://github.com/COS301-SE-2022/MathU-Sim…
MattReed-ZA Sep 29, 2022
14e18b6
👽️ (UI):
MattReed-ZA Sep 29, 2022
24c35d2
👽️ (UI):
MattReed-ZA Sep 29, 2022
303b9fb
👽️ (UI):
MattReed-ZA Sep 29, 2022
14b62b9
👽️ (UI):
MattReed-ZA Sep 29, 2022
e343380
👽️ (UI):
MattReed-ZA Sep 29, 2022
d9bcf72
👽️ (UI):
MattReed-ZA Sep 29, 2022
e015af9
👽️ (UI):
MattReed-ZA Sep 29, 2022
f834056
👽️ (UI):
MattReed-ZA Sep 29, 2022
a919b78
👽️ (UI):
MattReed-ZA Sep 29, 2022
6303fe5
👽️ (UI):
MattReed-ZA Sep 29, 2022
7fe5d33
👽️ (UI):
MattReed-ZA Sep 29, 2022
ed19a44
👽️ (UI):
MattReed-ZA Sep 29, 2022
a3c90d9
👽️ (UI):
MattReed-ZA Sep 29, 2022
8560794
👽️ (UI):
MattReed-ZA Sep 29, 2022
e2a673c
👽️ (UI):
MattReed-ZA Sep 29, 2022
327f829
💄(UI):
MattReed-ZA Sep 29, 2022
4563dbf
👽️ 💄 (UI):
MattReed-ZA Sep 29, 2022
434fa36
Merge branch 'develop' of https://github.com/COS301-SE-2022/MathU-Sim…
MattReed-ZA Sep 29, 2022
f6cf47c
🐛 (UI):
MattReed-ZA Sep 29, 2022
44b14f9
👽️ 🐛 (UI):
MattReed-ZA Sep 29, 2022
e567fc6
🐛 (UI):
MattReed-ZA Sep 29, 2022
2c3923f
🐛 (UI):
MattReed-ZA Sep 29, 2022
41e2afd
🔥 (UI):
MattReed-ZA Sep 29, 2022
05041f6
🐛 (UI):
MattReed-ZA Sep 29, 2022
0899458
🔥 (UI):
MattReed-ZA Sep 29, 2022
4d4da51
⚰️ (UI):
MattReed-ZA Sep 29, 2022
b9017ff
👽️ (UI):
MattReed-ZA Sep 29, 2022
704c92c
💄 (UI):
MattReed-ZA Sep 29, 2022
a6a195d
👽️ (UI):
MattReed-ZA Sep 29, 2022
a8ebf9e
💄 (UI):
MattReed-ZA Sep 29, 2022
467e7e0
💄 (UI):
MattReed-ZA Sep 29, 2022
43aec8a
💄 (UI):
MattReed-ZA Sep 29, 2022
ee29903
💄 ✨ (UI):
MattReed-ZA Sep 29, 2022
aa4d541
💄 (UI):
MattReed-ZA Sep 29, 2022
619331a
💄 (UI):
MattReed-ZA Sep 29, 2022
3e392fb
🔀 Develop into Matthew
MattReed-ZA Sep 29, 2022
94b7384
🚧 (UI):
MattReed-ZA Sep 29, 2022
7171308
🐛 (UI):
MattReed-ZA Sep 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
530 changes: 265 additions & 265 deletions packages/client/.firebase/hosting.YnVpbGRcd2Vi.cache

Large diffs are not rendered by default.

47 changes: 26 additions & 21 deletions packages/client/lib/SearchResultItem.dart
Expand Up @@ -2,6 +2,9 @@
import 'package:flutter/material.dart';
import 'package:client/apiInterface.dart';
import 'package:client/equationOverview.dart';
import 'package:flutter_tex/flutter_tex.dart';
import 'dart:convert';
import 'package:math_keyboard/math_keyboard.dart';

/*
NOTE
Expand All @@ -18,8 +21,8 @@ class SearchResultItem extends StatefulWidget {
required this.conf_score,
required this.problemID})
: super(key: key);
final String equation, conf_score, problemID;

final String equation, conf_score;
final int problemID;
@override
State<SearchResultItem> createState() => _SearchResultItemState();
}
Expand All @@ -30,13 +33,12 @@ class _SearchResultItemState extends State<SearchResultItem> {
bool saved = false;
bool removed = false;

checkIsSaved(String pid) async {
//List<dynamic> savedResults = await apiObj.getSavedResults();
List<dynamic> savedResults = apiObj.getLocalUserSaved();
checkIsSaved(int pid) async {
List<dynamic> savedResults = await apiObj.getSavedResults();

if (savedResults.isNotEmpty) {
if (savedResults != null && savedResults.isNotEmpty) {
for (int i = 0; i < savedResults.length; i++) {
if (savedResults[i]['equation']['id'] == pid) {
if (savedResults[i]['id'] == pid) {
return true;
}
}
Expand All @@ -51,11 +53,17 @@ class _SearchResultItemState extends State<SearchResultItem> {
}

@override
Widget build(BuildContext context) {
void initState() async {
super.initState();

isLoggedIn = checkIsLoggedIn();
if (isLoggedIn) {
isColored = checkIsSaved(widget.problemID);
isColored = await checkIsSaved(widget.problemID);
}
}

@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.fromLTRB(50.0, 10.0, 50.0, 0),
child: Padding(
Expand All @@ -69,7 +77,6 @@ class _SearchResultItemState extends State<SearchResultItem> {
wordSpacing: 4.5,
fontSize: 24.0,
),
//textAlign: TextAlign.center,
),
subtitle: Text(
'Confidence Rating: ${widget.conf_score}',
Expand All @@ -84,7 +91,6 @@ class _SearchResultItemState extends State<SearchResultItem> {
icon: (isColored)
? Icon(Icons.star, color: Colors.amberAccent)
: Icon(Icons.star_border_outlined),
//color: (isColored) ? Colors.amberAccent : Colors.white,
)
: null,
trailing: Icon(Icons.arrow_forward_ios),
Expand All @@ -94,13 +100,6 @@ class _SearchResultItemState extends State<SearchResultItem> {
}

void saveToFavourites() {
/*
@TODO
1. Create an API Object
2. Use API Object to add equation to saved equations
3. Change icon to be shaded in
*/

setState(() async {
isColored = !isColored;

Expand All @@ -127,8 +126,14 @@ class _SearchResultItemState extends State<SearchResultItem> {
context,
MaterialPageRoute(
builder: (context) => EquationOverview(
equation: widget.equation,
//conf_score: widget.conf_score,
problemID: widget.problemID)));
equation: widget.equation, problemID: widget.problemID)));
}
}

/*
For Rendering Properly
TeXView(
child: TeXViewDocument(widget.equation),
renderingEngine: TeXViewRenderingEngine.mathjax(),
),
*/
2 changes: 1 addition & 1 deletion packages/client/lib/UserData.dart
Expand Up @@ -18,7 +18,7 @@ class UserData {

UserData._internal();

String _userID = 'test@email.com';
String _userID = 'default';
String _apiKey = 'default';
bool _isLoggedIn = false;
bool _isAdmin = false;
Expand Down
85 changes: 83 additions & 2 deletions packages/client/lib/admin_page.dart
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:client/apiInterface.dart';
import 'package:client/titlebar.dart';
import 'package:client/NavigationDrawer.dart';
import 'package:client/load_icon.dart';

/*
NOTE
Expand All @@ -24,6 +25,25 @@ class AdminPage extends StatefulWidget {

class _AdminPageState extends State<AdminPage> {
bool autoCaching = false;
bool isLoading = false;

void checkServerSettings() async {
setState(() {
isLoading = true;
});
dynamic temp = await apiObj.getServerSettings();
setState(() {
isLoading = false;
autoCaching = temp['autocaching'];
});
}

@override
void initState() {
// TODO: implement initState
super.initState();
checkServerSettings();
}

@override
Widget build(BuildContext context) {
Expand All @@ -35,6 +55,10 @@ class _AdminPageState extends State<AdminPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Visibility(
visible: isLoading,
child: LoadIcon(),
),
SizedBox(
width: 800,
child: Card(
Expand All @@ -54,6 +78,47 @@ class _AdminPageState extends State<AdminPage> {
setState(() => autoCaching = val);
},
),
ElevatedButton(
style: ButtonStyle(
elevation:
MaterialStateProperty.resolveWith<double>(
((states) => 0)),
backgroundColor:
MaterialStateProperty.resolveWith(getColor),
),
child: Text('Confirm'),
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: const Text('Making Changes?'),
content: SingleChildScrollView(
child: ListBody(
children: [
Text(
'We need your password to approve this action'),
TextFormField(
obscureText: true,
),
],
),
),
actions: <Widget>[
TextButton(
onPressed: () =>
Navigator.pop(context, 'Cancel'),
child: const Text('Cancel'),
),
TextButton(
onPressed: () =>
Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
},
),
],
),
),
Expand Down Expand Up @@ -85,7 +150,7 @@ class _AdminPageState extends State<AdminPage> {
backgroundColor:
MaterialStateProperty.resolveWith(getColor),
),
child: Text('Authenticate'),
child: Text('Confirm'),
onPressed: () {
showDialog(
context: context,
Expand Down Expand Up @@ -149,7 +214,7 @@ class _AdminPageState extends State<AdminPage> {
backgroundColor:
MaterialStateProperty.resolveWith(getColor),
),
child: Text('Authenticate'),
child: Text('Confirm'),
onPressed: () {
showDialog(
context: context,
Expand Down Expand Up @@ -194,6 +259,22 @@ class _AdminPageState extends State<AdminPage> {
);
}

void setAutoCaching(String pw) async {
dynamic temp = await apiObj.setServerSettings(autoCaching, pw);

checkServerSettings();

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: (temp['success'])
? Text('Change Recorded')
: Text('Woops, Something went wrong...'),
width: 400,
behavior: SnackBarBehavior.floating,
duration: const Duration(milliseconds: 1500),
padding: EdgeInsets.all(10),
));
}

Color getColor(Set<MaterialState> states) {
const Set<MaterialState> interactiveStates = <MaterialState>{
MaterialState.pressed,
Expand Down