From 3035ddd5b1ddc33817c571d3f7c1ddaafc33f92b Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Sun, 7 Dec 2025 18:59:27 +0000 Subject: [PATCH] Reformated code to match prettier formating --- src/components/entity/users/UserForm.js | 20 ++++++++--------- src/components/entity/users/UserItem.js | 5 +++-- src/components/entity/users/UserView.js | 26 +++++++++++----------- src/components/screens/ModuleListScreen.js | 2 +- src/components/screens/ModuleViewScreen.js | 2 +- src/components/screens/UserListScreen.js | 16 ++++++------- src/components/screens/UserModifyScreen.js | 4 ++-- src/components/screens/UserViewScreen.js | 8 +++---- 8 files changed, 42 insertions(+), 41 deletions(-) diff --git a/src/components/entity/users/UserForm.js b/src/components/entity/users/UserForm.js index 4fd562f..37cd4f6 100644 --- a/src/components/entity/users/UserForm.js +++ b/src/components/entity/users/UserForm.js @@ -1,5 +1,5 @@ -import { Text } from "react-native"; -import { useState } from "react"; +import {Text} from "react-native"; +import {useState} from "react"; import Icons from "../../UI/Icons"; import Form from "../../UI/Form"; import useLoad from "../../API/useLoad"; @@ -15,7 +15,7 @@ const defaultUser = { UserImageURL: null, }; -const UserForm = ({ originalUser, onSubmit, onCancel }) => { +const UserForm = ({originalUser, onSubmit, onCancel}) => { // Initialisation ------------- defaultUser.UserID = Math.floor(100000 + Math.random() * 900000); @@ -25,11 +25,11 @@ const UserForm = ({ originalUser, onSubmit, onCancel }) => { const yearsEndpoint = 'https://softwarehub.uk/unibase/api/years'; const levels = [ - { value: 3, label: '3 (Foundation)' }, - { value: 4, label: '4 (First Year)' }, - { value: 5, label: '5 (Second Year)' }, - { value: 6, label: '6 (Third Year)' }, - { value: 7, label: '7 (Masters)' }, + {value: 3, label: '3 (Foundation)'}, + {value: 4, label: '4 (First Year)'}, + {value: 5, label: '5 (Second Year)'}, + {value: 6, label: '6 (Third Year)'}, + {value: 7, label: '7 (Masters)'}, ]; // State ---------------------- @@ -42,7 +42,7 @@ const UserForm = ({ originalUser, onSubmit, onCancel }) => { // Handlers ------------------- const handleChange = (field, value) => { - setUser({ ...user, [field]: value }); + setUser({...user, [field]: value}); }; const handleSubmit = () => onSubmit(user); @@ -50,7 +50,7 @@ const UserForm = ({ originalUser, onSubmit, onCancel }) => { // View ----------------------- const submitLabel = originalUser ? 'Modify' : 'Add'; - const submitIcon = originalUser ? : ; + const submitIcon = originalUser ? : ; const usertypeOptions = userTypes.map((usertype) => ({ value: usertype.UsertypeID, diff --git a/src/components/entity/users/UserItem.js b/src/components/entity/users/UserItem.js index 0f79d02..2b5110c 100644 --- a/src/components/entity/users/UserItem.js +++ b/src/components/entity/users/UserItem.js @@ -1,7 +1,7 @@ -import { StyleSheet, Text, View, Pressable } from "react-native"; +import {StyleSheet, Text, View, Pressable} from "react-native"; import useLoad from "../../API/useLoad"; -const UserItem = ({ user, onSelect }) => { +const UserItem = ({user, onSelect}) => { // Initialisation ------------- const usertypesEndpoint = 'https://softwarehub.uk/unibase/api/usertypes'; @@ -17,6 +17,7 @@ const UserItem = ({ user, onSelect }) => { // State ---------------------- // Handlers ------------------- // View ----------------------- + return ( onSelect(user)}> diff --git a/src/components/entity/users/UserView.js b/src/components/entity/users/UserView.js index 01c8b99..832ad6e 100644 --- a/src/components/entity/users/UserView.js +++ b/src/components/entity/users/UserView.js @@ -1,19 +1,19 @@ -import { Alert, StyleSheet, Text, View } from "react-native"; +import {Alert, StyleSheet, Text, View} from "react-native"; import FullWidthImage from "react-native-fullwidth-image"; -import { Button, ButtonTray } from "../../UI/Button"; +import {Button, ButtonTray} from "../../UI/Button"; import Icons from "../../UI/Icons.js"; -const UserView = ({ user, onDelete, onModify }) => { +const UserView = ({user, onDelete, onModify}) => { // Initialisation ------------- const fullName = `${user.UserFirstname} ${user.UserLastname}`; const levels = [ - { value: 3, label: '3 (Foundation)' }, - { value: 4, label: '4 (First Year)' }, - { value: 5, label: '5 (Second Year)' }, - { value: 6, label: '6 (Third Year)' }, - { value: 7, label: '7 (Masters)' }, + {value: 3, label: '3 (Foundation)'}, + {value: 4, label: '4 (First Year)'}, + {value: 5, label: '5 (Second Year)'}, + {value: 6, label: '6 (Third Year)'}, + {value: 7, label: '7 (Masters)'}, ]; // State ---------------------- @@ -26,8 +26,8 @@ const UserView = ({ user, onDelete, onModify }) => { 'Delete Warning', `Are you sure you want to delete user ${fullName}?`, [ - { text: 'Cancel' }, - { text: 'Delete', onPress: handleDelete } + {text: 'Cancel'}, + {text: 'Delete', onPress: handleDelete} ] ); }; @@ -38,7 +38,7 @@ const UserView = ({ user, onDelete, onModify }) => { return ( - + {fullName} @@ -51,12 +51,12 @@ const UserView = ({ user, onDelete, onModify }) => {