Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Salamander - APP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eirik Martin Danielsen
Salamander - APP
Commits
1fd36355
Commit
1fd36355
authored
Jun 14, 2021
by
Andrea Magnussen
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation to constant files
parent
d0853f7e
No related branches found
No related tags found
1 merge request
!70
Resolve "Add comments to all files"
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
assets/themes/Theme.js
+4
-1
4 additions, 1 deletion
assets/themes/Theme.js
constants/context.js
+5
-0
5 additions, 0 deletions
constants/context.js
constants/inputRequirements.js
+5
-0
5 additions, 0 deletions
constants/inputRequirements.js
constants/toasts.js
+30
-1
30 additions, 1 deletion
constants/toasts.js
with
44 additions
and
2 deletions
assets/themes/Theme.js
+
4
−
1
View file @
1fd36355
import
React
from
"
react
"
;
import
{
DefaultTheme
}
from
"
react-native-paper
"
;
/**
* Defines the overall theme of the application. See https://callstack.github.io/react-native-paper/theming.html for more documentation.
*/
const
theme
=
{
...
DefaultTheme
,
roundness
:
2
,
...
...
This diff is collapsed.
Click to expand it.
constants/context.js
+
5
−
0
View file @
1fd36355
import
React
from
"
react
"
;
/**
* Used for remembering if the user is logged in or not. It was a early way of doing it, it might be better to
* stick with using redux instead to handle which screens should be visible based on user status.
*/
export
const
AuthContext
=
React
.
createContext
();
This diff is collapsed.
Click to expand it.
constants/inputRequirements.js
+
5
−
0
View file @
1fd36355
/**
* These constants are used for the restrictions and regexes throughout the application
*/
export
const
NAME_MAX_LENGTH
=
40
;
export
const
NUMBER_MAX_LENGTH
=
15
;
export
const
LOCATION_NUMBER_MAX_LENGTH
=
4
;
...
...
This diff is collapsed.
Click to expand it.
constants/toasts.js
+
30
−
1
View file @
1fd36355
import
React
from
'
react
'
/**
* This file includes various toasts the user can get. More documentation on this: https://www.npmjs.com/package/react-native-toast-message
*/
import
Toast
from
"
react-native-toast-message
"
;
/**
* Shows a toast/response message to the user that everything went well (statuscode 200).
*
* @param {String} pos - position of the toast
* @param {Integer} time - how long the toast should be visible
* @param {String} message - displays information to the user.
*/
export
const
toastSuccess
=
(
pos
,
time
,
message
)
=>
{
Toast
.
show
({
type
:
"
success
"
,
...
...
@@ -11,6 +21,13 @@ export const toastSuccess = (pos, time, message) => {
});
}
/**
* Shows a toast/response message to the user that something went wrong (statuscode 4XX).
*
* @param {String} pos - position of the toast
* @param {Integer} time - how long the toast should be visible
* @param {String} message - displays information to the user.
*/
export
const
toastError
=
(
pos
,
time
,
message
)
=>
{
Toast
.
show
({
type
:
"
error
"
,
...
...
@@ -21,6 +38,13 @@ export const toastError = (pos, time, message) => {
});
}
/**
* Shows a toast/response message that provides information to the user.
*
* @param {String} pos - position of the toast
* @param {Integer} time - how long the toast should be visible
* @param {String} message - displays information to the user.
*/
export
const
toastInfo
=
(
pos
,
time
,
message
)
=>
{
Toast
.
show
({
type
:
"
info
"
,
...
...
@@ -31,6 +55,11 @@ export const toastInfo = (pos, time, message) => {
});
}
/**
* Will be displayed if the server is not responding/it failed before reaching the server.
*
* @param {Integer} statusCode - will provide different messages based on numerous status codes.
*/
export
const
toast500
=
(
statusCode
)
=>
{
let
errorText
=
""
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment