diff --git a/docs/source/Database.rst b/docs/source/Database.rst new file mode 100644 index 000000000..a845fbbaa --- /dev/null +++ b/docs/source/Database.rst @@ -0,0 +1,29 @@ +Viewing the database +============= + +.. _database: + +Creating and admin account +----------------- + +To view the database, you first need to create an admin account. While the database is onlinee, paste the following into a new terminal: + +.. code-block:: console + + cd backend + python manage.py createsuperuser + +Then follow the prompts to create a username and password. Since the database is only available from your desktop (as this is a work-in-progress project), it can be as simple as admin/admin. + + +Accessing the database +--------------------- + +To view the contents of the database, follow this `link `_. This will only be accessible if the database is runing on your current device. You will be redirected to a page with a username and password. Use the details from the superuser prompt to log in. + +Navigating the database +----------------------- + +After logging in, all tables will be visible. If you sign up on the sign up page in the website, it will appear in the users table. You can use this feature to track all data within the database. + +.. image:: images/Database.png diff --git a/docs/source/Frontend.rst b/docs/source/Frontend.rst new file mode 100644 index 000000000..672a4cb46 --- /dev/null +++ b/docs/source/Frontend.rst @@ -0,0 +1,302 @@ + +Frontend +============= + +Overview +============= + +The front end of this application is different each device. This doc will cover some of the front end choices and inner workings, but in terms of what you can expect to see throughout the app, you can find: + +Fonts +----- + +Android: Roboto + +iOS/macOS: San Francisco + +Windows: Segoe UI + +Linux/web: platform/browser default sans-serif chosen by Flutter + + +Colours +------- + +One consistent colour theme, featuring the colours represented in the University of Portsmouth logo. + +Seed colour: 0xFF003087 + +Primary colour: 0xFF003087 + +Secondary colour: 0xFF7B2D8E + +Background colour: 0x29FFFFFF + +Error colour: 0xFFBA1A1A + +Text colour: Not fixed, readable contrast via code: + +.. code-block:: dart + + style: Theme.of(context).textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.w700, + +Pages +====== + +main.dart +--------- + +Theme +------ + +.. code-block:: dart + + class UnifyApp extends StatelessWidget { + const UnifyApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Unify - University of Portsmouth Societies', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed( + seedColor: const Color(0xFF003087), // UoP Blue + primary: const Color(0xFF003087), // UoP Blue + secondary: const Color(0xFF7B2D8E), // UoP Purple + ), + appBarTheme: const AppBarTheme( + foregroundColor: Colors.white, + iconTheme: IconThemeData(color: Colors.white), + ), + useMaterial3: true, + ), + home: const HomePage(), + ); + } + } + +This section of code initialises the color scheme throughout the whole program, the navigation bar color scheme, annd ensures it is the first page shown to the user when starting the app. + +User login data +---------------- + +.. code-block:: dart + + class _HomePageState extends State { + static const String _sessionUserStorageKey = 'unify.current_user'; + +This section of code uses a const key for saving/loading the user login data by storing it in local storage. + +Navigation Bar +--------------- + +.. code-block:: dart + + IconButton( + tooltip: 'Account', + onPressed: _openAuthPage, + icon: const Icon(Icons.person, color: Colors.white), + ), + TextButton( + onPressed: _openAboutUsPage, + child: const Text( + 'About Us', + style: TextStyle(color: Colors.white, fontSize: 16), + ), + ), + ], + bottom: PreferredSize( + preferredSize: Size.fromHeight(_showHeaderSearch ? 72 : 0), + child: _showHeaderSearch + ? Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), + child: TextField( + controller: _searchController, + focusNode: _searchFocusNode, + textInputAction: TextInputAction.search, + onSubmitted: _openSearchResultsPage, + decoration: InputDecoration( + hintText: 'Search societies, e.g. "Art", "Gaming"', + prefixIcon: const Icon(Icons.search), + suffixIcon: IconButton( + icon: const Icon(Icons.arrow_forward), + onPressed: _openSearchResultsPage, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(14.0), + borderSide: BorderSide.none, + ), + filled: true, + fillColor: Colors.white, + ), + ), + ) + : const SizedBox.shrink(), + ), + ), + +This section of code creates the Navigation Bar at the top of the page. It creates a Account button which links to the login page, an About us button which links to the About Us page, and a search bar used to search for societies. These are all in the far right of the navigation bar, and the search bar extends when pressed. + +Intro Text +----------- + + .. code-block:: dart + + body: SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(16, 14, 16, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Welcome${_currentUser == null ? '' : ', ${_currentUser!['name'] ?? 'back'}'}', + style: Theme.of(context).textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 8), + Text( + 'Find societies that match your interests and connect with students faster.', + style: Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(height: 1.35), + ), + +This code displays the text at the top of the page, "Welcome" and "Find societies that match your interests and connect with students faster" + +Joined societies list - Logged in + Not in any society +------------------------------------------------------- + +.. code-block:: dart + + if (joined.isEmpty) { + return Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + const Icon(Icons.info_outline), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + const Text( + 'You haven\'t joined any societies yet', + style: TextStyle( + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 6), + Text( + 'Tap "Find societies" to browse and join groups.', + style: TextStyle( + color: Colors.grey.shade700, + ), + ), + ], + ), + ), + TextButton( + onPressed: _openSocietiesPage, + child: const Text('Find societies'), + ), + ], + ), + ), + ); + } + + +Joined societies list - Logged in + In a society +------------------------------------------------ + +..code-block:: dart + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Your societies', + style: Theme.of(context).textTheme.titleMedium + ?.copyWith(fontWeight: FontWeight.w700), + ), + const SizedBox(height: 8), + SizedBox( + height: 140, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: joined.length, + separatorBuilder: (_, __) => + const SizedBox(width: 12), + itemBuilder: (context, index) { + final s = joined[index]; + return InkWell( + onTap: () => _navigateToSocietyDetails( + s, + initialJoined: true, + ), + child: SizedBox( + width: 220, + child: Card( + clipBehavior: Clip.antiAlias, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + CircleAvatar( + radius: 28, + child: Icon(s.icon, size: 28), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Text( + s.name, + style: const TextStyle( + fontWeight: FontWeight.w700, + ), + overflow: + TextOverflow.ellipsis, + ), + const SizedBox(height: 6), + Text( + '${s.memberCount} members · ${s.rating} ★', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.grey.shade700, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ); + }, + ), + ), + const SizedBox(height: 12), + ], + ); + }, + + + diff --git a/docs/source/api.rst b/docs/source/api.rst deleted file mode 100644 index ec94338a6..000000000 --- a/docs/source/api.rst +++ /dev/null @@ -1,7 +0,0 @@ -API -=== - -.. autosummary:: - :toctree: generated - - lumache diff --git a/docs/source/conf.py b/docs/source/conf.py index 6e9e8c087..7169812a9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -2,9 +2,9 @@ # -- Project information -project = 'Lumache' -copyright = '2021, Graziella' -author = 'Graziella' +project = 'Unify' +copyright = '2026, Unify' +author = 'Joshua Rae Alcazar' release = '0.1' version = '0.1.0' diff --git a/docs/source/images/Database.png b/docs/source/images/Database.png new file mode 100644 index 000000000..3c912dea4 Binary files /dev/null and b/docs/source/images/Database.png differ diff --git a/docs/source/images/Login.png b/docs/source/images/Login.png new file mode 100644 index 000000000..7cd9dd1d3 Binary files /dev/null and b/docs/source/images/Login.png differ diff --git a/docs/source/images/Signup.png b/docs/source/images/Signup.png new file mode 100644 index 000000000..d0240ceb4 Binary files /dev/null and b/docs/source/images/Signup.png differ diff --git a/docs/source/images/SocietyReview.png b/docs/source/images/SocietyReview.png new file mode 100644 index 000000000..4d8218c72 Binary files /dev/null and b/docs/source/images/SocietyReview.png differ diff --git a/docs/source/index.rst b/docs/source/index.rst index 03d09a55d..4765f9b07 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,10 +1,7 @@ -Welcome to Lumache's documentation! +Welcome to Unify's documentation! =================================== -**Lumache** (/lu'make/) is a Python library for cooks and food lovers -that creates recipes mixing random ingredients. -It pulls data from the `Open Food Facts database `_ -and offers a *simple* and *intuitive* API. +Unify is a student created, university focused website focused on societies, students and ease of access. Check out the :doc:`usage` section for further information, including how to :ref:`installation` the project. @@ -19,4 +16,17 @@ Contents .. toctree:: usage - api + login + joinsoc + review + database + + +.. toctree:: + + Frontend + Backend + Database + + +Unify hosts its documentation on Read the Docs. diff --git a/docs/source/joinsoc.rst b/docs/source/joinsoc.rst new file mode 100644 index 000000000..15920f74a --- /dev/null +++ b/docs/source/joinsoc.rst @@ -0,0 +1,16 @@ +Join Society +============= + +.. _joinsoc: + +Joining a society +----------------- + +To join a society, you first have to be logged in. (refer to login page) After logging in, you can select a society using the "Find societies" button. +This will show you a list of societies, where you can search and filter for your specific interests. To join, click on the society you want to join, +and press the prompted button + +Leaving a society +------------------ +In order to leave, simply press the "Joined" button, and this will make you leave the society. + diff --git a/docs/source/login.rst b/docs/source/login.rst new file mode 100644 index 000000000..ed1ab47db --- /dev/null +++ b/docs/source/login.rst @@ -0,0 +1,22 @@ +Login +===== + +.. _login: + +Login/Sign up +--------------- + +To log in or sign up, either click the top right user icon, or the "Join a Society today" button. +You will be prompted to input your email and password. If you have not created an account, use the "Create Account" button. + +.. image:: images/Login.png + + +.. _signup: + +Sign up +---------------- + +When signing up to use the website, you need to input your preferred name, email, and password. This will then be stored in our database, and will allow you to log in from the login screen. + +.. image:: images/Signup.png diff --git a/docs/source/review.rst b/docs/source/review.rst new file mode 100644 index 000000000..b13bad3fe --- /dev/null +++ b/docs/source/review.rst @@ -0,0 +1,12 @@ +Review +===== + +.. _review: + +Create Review +--------------- + +You can only leave a review in a society you have joined. to leave a review, input the rating (out of 5) and enter a comment. Your review +will be visible to everyone, regardless of whether they are in the society or not. This is to help users make decisions in what societies to join. + +.. image:: images/SocietyReview.png diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 924afcf6c..d13ea10c4 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -1,34 +1,26 @@ Usage ===== -.. _installation: +.. _startdatabase: -Installation +Start Database ------------ -To use Lumache, first install it using pip: +To start the database (as it is local during development), cd to backend and run the command ''python manage.py runserver'' .. code-block:: console - (.venv) $ pip install lumache + cd backend + ..\.venv\Scripts\activate + python manage.py runserver 0.0.0.0:8000 -Creating recipes +Start App ---------------- -To retrieve a list of random ingredients, -you can use the ``lumache.get_random_ingredients()`` function: +To run the app, navigate to ''main.dart'' and run without debugging. Choose any browser when it is prompted. +Alternatively, run this in a new terminal (after the server is running) -.. autofunction:: lumache.get_random_ingredients - -The ``kind`` parameter should be either ``"meat"``, ``"fish"``, -or ``"veggies"``. Otherwise, :py:func:`lumache.get_random_ingredients` -will raise an exception. - -.. autoexception:: lumache.InvalidKindError - -For example: - ->>> import lumache ->>> lumache.get_random_ingredients() -['shells', 'gorgonzola', 'parsley'] +.. code-block:: console + cd "unify_frontend" + flutter run -d chrome