Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
795de75da4 | ||
|
|
60bf8be58d | ||
|
|
d443b794c3 | ||
|
|
361a8ac6eb | ||
|
|
9adc01f870 | ||
|
|
98d4aa345a | ||
|
|
8577995d4a | ||
|
|
a494f5225a | ||
|
|
8ff550cd6f | ||
|
|
6ee401e3d5 | ||
|
|
d0ed913d7c | ||
|
|
9c1fc2e885 | ||
|
|
c8af1fc61f | ||
|
|
a3d8285265 | ||
|
|
5debff0ae7 | ||
|
|
ec21abc7d4 | ||
|
|
bcc2e45697 | ||
|
|
c9f24e3ce2 | ||
|
|
fc211acb98 | ||
|
|
6c8ab4aadd | ||
|
|
1addd5cead | ||
|
|
dc8074fb21 | ||
|
|
f29b9d2be6 | ||
|
|
0e6383891a | ||
|
|
7a32bbc0c4 |
No files matched your search
@@ -1,35 +0,0 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: 'Bug: TITLE'
|
||||
labels: New Issue
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is this issue related to the phone still being in development?**
|
||||
If so, please consult the [gitkraken](https://app.gitkraken.com/glo/board/X9YZ_x_SVQEcMwpH) to see if it's already being tracked.
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Evidence**
|
||||
If applicable, add a screenshot or a video to help explain your problem.
|
||||
|
||||
**Needed information (please complete the following information):**
|
||||
- **Server OS**: [e.g. Windows 10]
|
||||
- **Server Artifact version**: [e.g. 3486] Don't know? Do `version` into your server console.
|
||||
- What version of **new-phone-who-dis** are you running?
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,21 +0,0 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest a feature that you would like added/improved upon.
|
||||
title: 'Enhancement: TITLE'
|
||||
labels: Enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem or design oversight? If so, please explain it.**
|
||||
Provide evidence to help support your claim so we can better understand such as pictures or a video.
|
||||
|
||||
**What is your suggestion?**
|
||||
Please include as much details as possible. Avoid vague suggestions such as "An app to order food with.". Include as much details as possible such as: "An app that will allow a player to order a food item of their choice and have a player/npc deliver it to them."
|
||||
|
||||
**Does your suggestion require any dependencies? (Jobs and Money are framework dependencies.)**
|
||||
|
||||
**Do you have any references to help us visualize your suggestion?**
|
||||
Such as "Here is a link to a similar concept: https://www.youtube.com/watch?v=j5a0jTc9S10 "
|
||||
|
||||
**Any additional comments or concerns?**
|
||||
@@ -1,10 +1,10 @@
|
||||
name: Test Suite
|
||||
name: Tests and CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
nui_preformatting_tests:
|
||||
name: Tests for NUI
|
||||
name: NUI Preformatting and Tests
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -34,13 +34,21 @@ jobs:
|
||||
node-version: '14.x'
|
||||
- name: Install dependencies NUI
|
||||
run: yarn --frozen-lockfile
|
||||
- name: Prettify Code
|
||||
uses: creyD/[email protected]
|
||||
with:
|
||||
# This part is also where you can pass other options, for example:
|
||||
prettier_options: --write **/*.{js,jsx,ts,tsx,json,css,scss,md}
|
||||
only_changed: True
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run Enzyme Tests
|
||||
run: yarn test
|
||||
env:
|
||||
CI: true
|
||||
|
||||
game_scripts_test:
|
||||
name: Tests for Game Scripts
|
||||
name: Formatting/Tests for Native Scripts
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -60,6 +68,14 @@ jobs:
|
||||
node-version: '14.x'
|
||||
- name: Install dependencies NUI
|
||||
run: yarn --frozen-lockfile
|
||||
- name: Prettify code
|
||||
uses: creyD/[email protected]
|
||||
with:
|
||||
# This part is also where you can pass other options, for example:
|
||||
prettier_options: --write **/*.{js,jsx,ts,tsx,json,css,scss,md}
|
||||
only_changed: True
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run Jest Tests
|
||||
run: yarn test
|
||||
env:
|
||||
|
||||
@@ -1,22 +1,2 @@
|
||||
# No IDE Folders
|
||||
# No intellij folder
|
||||
.idea
|
||||
|
||||
resources/html
|
||||
|
||||
phone/.eslintcache
|
||||
|
||||
# Node Modules and Built Folders
|
||||
node_modules
|
||||
build
|
||||
dist
|
||||
|
||||
# Error Logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Mac thing
|
||||
.DS_Store
|
||||
|
||||
# Debug logs
|
||||
sv_npwd.log
|
||||
@@ -1 +0,0 @@
|
||||
_
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [ -z "$husky_skip_init" ]; then
|
||||
debug () {
|
||||
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
|
||||
}
|
||||
|
||||
readonly hook_name="$(basename "$0")"
|
||||
debug "starting $hook_name..."
|
||||
|
||||
if [ "$HUSKY" = "0" ]; then
|
||||
debug "HUSKY env variable is set to 0, skipping hook"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f ~/.huskyrc ]; then
|
||||
debug "sourcing ~/.huskyrc"
|
||||
. ~/.huskyrc
|
||||
fi
|
||||
|
||||
export readonly husky_skip_init=1
|
||||
sh -e "$0" "$@"
|
||||
exitCode="$?"
|
||||
|
||||
if [ $exitCode != 0 ]; then
|
||||
echo "husky - $hook_name hook exited with code $exitCode (error)"
|
||||
exit $exitCode
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn pretty-quick --staged
|
||||
@@ -1,9 +0,0 @@
|
||||
build
|
||||
dist
|
||||
coverage
|
||||
node_modules
|
||||
.idea
|
||||
.github
|
||||
.vscode
|
||||
resources/html
|
||||
resources/dist
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"semi": true,
|
||||
"bracketSpacing": true,
|
||||
"trailingComma": "all",
|
||||
"useTabs": false,
|
||||
"tabWidth": 2
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
Kidz
|
||||
ItsChip
|
||||
ROCKY_southpaw
|
||||
Kire
|
||||
TasoOneAsia
|
||||
@@ -1,594 +1,11 @@
|
||||
GNU General Public License
|
||||
==========================
|
||||
Copyright (c) BTNGaming, itzchip, ROCKY_southpaw
|
||||
|
||||
_Version 3, 29 June 2007_
|
||||
_Copyright © 2007 Free Software Foundation, Inc. <<http://fsf.org/>>_
|
||||
All rights reserved.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
Even if 'All rights reserved' is very clear :
|
||||
|
||||
## Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other
|
||||
kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away
|
||||
your freedom to share and change the works. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change all versions of a
|
||||
program--to make sure it remains free software for all its users. We, the Free
|
||||
Software Foundation, use the GNU General Public License for most of our software; it
|
||||
applies also to any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General
|
||||
Public Licenses are designed to make sure that you have the freedom to distribute
|
||||
copies of free software (and charge for them if you wish), that you receive source
|
||||
code or can get it if you want it, that you can change the software or use pieces of
|
||||
it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or
|
||||
asking you to surrender the rights. Therefore, you have certain responsibilities if
|
||||
you distribute copies of the software, or if you modify it: responsibilities to
|
||||
respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee,
|
||||
you must pass on to the recipients the same freedoms that you received. You must make
|
||||
sure that they, too, receive or can get the source code. And you must show them these
|
||||
terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: **(1)** assert
|
||||
copyright on the software, and **(2)** offer you this License giving you legal permission
|
||||
to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is
|
||||
no warranty for this free software. For both users' and authors' sake, the GPL
|
||||
requires that modified versions be marked as changed, so that their problems will not
|
||||
be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of
|
||||
the software inside them, although the manufacturer can do so. This is fundamentally
|
||||
incompatible with the aim of protecting users' freedom to change the software. The
|
||||
systematic pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we have designed
|
||||
this version of the GPL to prohibit the practice for those products. If such problems
|
||||
arise substantially in other domains, we stand ready to extend this provision to
|
||||
those domains in future versions of the GPL, as needed to protect the freedom of
|
||||
users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should
|
||||
not allow patents to restrict development and use of software on general-purpose
|
||||
computers, but in those that do, we wish to avoid the special danger that patents
|
||||
applied to a free program could make it effectively proprietary. To prevent this, the
|
||||
GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
## TERMS AND CONDITIONS
|
||||
|
||||
### 0. Definitions
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as “you”. “Licensees” and
|
||||
“recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in
|
||||
a fashion requiring copyright permission, other than the making of an exact copy. The
|
||||
resulting work is called a “modified version” of the earlier work or a
|
||||
work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on
|
||||
the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for infringement under
|
||||
applicable copyright law, except executing it on a computer or modifying a private
|
||||
copy. Propagation includes copying, distribution (with or without modification),
|
||||
making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through a computer
|
||||
network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the
|
||||
extent that it includes a convenient and prominently visible feature that **(1)**
|
||||
displays an appropriate copyright notice, and **(2)** tells the user that there is no
|
||||
warranty for the work (except to the extent that warranties are provided), that
|
||||
licensees may convey the work under this License, and how to view a copy of this
|
||||
License. If the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
### 1. Source Code
|
||||
|
||||
The “source code” for a work means the preferred form of the work for
|
||||
making modifications to it. “Object code” means any non-source form of a
|
||||
work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of interfaces
|
||||
specified for a particular programming language, one that is widely used among
|
||||
developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than
|
||||
the work as a whole, that **(a)** is included in the normal form of packaging a Major
|
||||
Component, but which is not part of that Major Component, and **(b)** serves only to
|
||||
enable use of the work with that Major Component, or to implement a Standard
|
||||
Interface for which an implementation is available to the public in source code form.
|
||||
A “Major Component”, in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system (if any) on which
|
||||
the executable work runs, or a compiler used to produce the work, or an object code
|
||||
interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the
|
||||
source code needed to generate, install, and (for an executable work) run the object
|
||||
code and to modify the work, including scripts to control those activities. However,
|
||||
it does not include the work's System Libraries, or general-purpose tools or
|
||||
generally available free programs which are used unmodified in performing those
|
||||
activities but which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for the work, and
|
||||
the source code for shared libraries and dynamically linked subprograms that the work
|
||||
is specifically designed to require, such as by intimate data communication or
|
||||
control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate
|
||||
automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
### 2. Basic Permissions
|
||||
|
||||
All rights granted under this License are granted for the term of copyright on the
|
||||
Program, and are irrevocable provided the stated conditions are met. This License
|
||||
explicitly affirms your unlimited permission to run the unmodified Program. The
|
||||
output from running a covered work is covered by this License only if the output,
|
||||
given its content, constitutes a covered work. This License acknowledges your rights
|
||||
of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without
|
||||
conditions so long as your license otherwise remains in force. You may convey covered
|
||||
works to others for the sole purpose of having them make modifications exclusively
|
||||
for you, or provide you with facilities for running those works, provided that you
|
||||
comply with the terms of this License in conveying all material for which you do not
|
||||
control copyright. Those thus making or running the covered works for you must do so
|
||||
exclusively on your behalf, under your direction and control, on terms that prohibit
|
||||
them from making any copies of your copyrighted material outside their relationship
|
||||
with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions
|
||||
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law
|
||||
|
||||
No covered work shall be deemed part of an effective technological measure under any
|
||||
applicable law fulfilling obligations under article 11 of the WIPO copyright treaty
|
||||
adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention
|
||||
of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of
|
||||
technological measures to the extent such circumvention is effected by exercising
|
||||
rights under this License with respect to the covered work, and you disclaim any
|
||||
intention to limit operation or modification of the work as a means of enforcing,
|
||||
against the work's users, your or third parties' legal rights to forbid circumvention
|
||||
of technological measures.
|
||||
|
||||
### 4. Conveying Verbatim Copies
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any
|
||||
medium, provided that you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice; keep intact all notices stating that this License and
|
||||
any non-permissive terms added in accord with section 7 apply to the code; keep
|
||||
intact all notices of the absence of any warranty; and give all recipients a copy of
|
||||
this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer
|
||||
support or warranty protection for a fee.
|
||||
|
||||
### 5. Conveying Modified Source Versions
|
||||
|
||||
You may convey a work based on the Program, or the modifications to produce it from
|
||||
the Program, in the form of source code under the terms of section 4, provided that
|
||||
you also meet all of these conditions:
|
||||
|
||||
* **a)** The work must carry prominent notices stating that you modified it, and giving a
|
||||
relevant date.
|
||||
* **b)** The work must carry prominent notices stating that it is released under this
|
||||
License and any conditions added under section 7. This requirement modifies the
|
||||
requirement in section 4 to “keep intact all notices”.
|
||||
* **c)** You must license the entire work, as a whole, under this License to anyone who
|
||||
comes into possession of a copy. This License will therefore apply, along with any
|
||||
applicable section 7 additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no permission to license the
|
||||
work in any other way, but it does not invalidate such permission if you have
|
||||
separately received it.
|
||||
* **d)** If the work has interactive user interfaces, each must display Appropriate Legal
|
||||
Notices; however, if the Program has interactive interfaces that do not display
|
||||
Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are
|
||||
not by their nature extensions of the covered work, and which are not combined with
|
||||
it such as to form a larger program, in or on a volume of a storage or distribution
|
||||
medium, is called an “aggregate” if the compilation and its resulting
|
||||
copyright are not used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work in an aggregate
|
||||
does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
### 6. Conveying Non-Source Forms
|
||||
|
||||
You may convey a covered work in object code form under the terms of sections 4 and
|
||||
5, provided that you also convey the machine-readable Corresponding Source under the
|
||||
terms of this License, in one of these ways:
|
||||
|
||||
* **a)** Convey the object code in, or embodied in, a physical product (including a
|
||||
physical distribution medium), accompanied by the Corresponding Source fixed on a
|
||||
durable physical medium customarily used for software interchange.
|
||||
* **b)** Convey the object code in, or embodied in, a physical product (including a
|
||||
physical distribution medium), accompanied by a written offer, valid for at least
|
||||
three years and valid for as long as you offer spare parts or customer support for
|
||||
that product model, to give anyone who possesses the object code either **(1)** a copy of
|
||||
the Corresponding Source for all the software in the product that is covered by this
|
||||
License, on a durable physical medium customarily used for software interchange, for
|
||||
a price no more than your reasonable cost of physically performing this conveying of
|
||||
source, or **(2)** access to copy the Corresponding Source from a network server at no
|
||||
charge.
|
||||
* **c)** Convey individual copies of the object code with a copy of the written offer to
|
||||
provide the Corresponding Source. This alternative is allowed only occasionally and
|
||||
noncommercially, and only if you received the object code with such an offer, in
|
||||
accord with subsection 6b.
|
||||
* **d)** Convey the object code by offering access from a designated place (gratis or for
|
||||
a charge), and offer equivalent access to the Corresponding Source in the same way
|
||||
through the same place at no further charge. You need not require recipients to copy
|
||||
the Corresponding Source along with the object code. If the place to copy the object
|
||||
code is a network server, the Corresponding Source may be on a different server
|
||||
(operated by you or a third party) that supports equivalent copying facilities,
|
||||
provided you maintain clear directions next to the object code saying where to find
|
||||
the Corresponding Source. Regardless of what server hosts the Corresponding Source,
|
||||
you remain obligated to ensure that it is available for as long as needed to satisfy
|
||||
these requirements.
|
||||
* **e)** Convey the object code using peer-to-peer transmission, provided you inform
|
||||
other peers where the object code and Corresponding Source of the work are being
|
||||
offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the
|
||||
Corresponding Source as a System Library, need not be included in conveying the
|
||||
object code work.
|
||||
|
||||
A “User Product” is either **(1)** a “consumer product”, which
|
||||
means any tangible personal property which is normally used for personal, family, or
|
||||
household purposes, or **(2)** anything designed or sold for incorporation into a
|
||||
dwelling. In determining whether a product is a consumer product, doubtful cases
|
||||
shall be resolved in favor of coverage. For a particular product received by a
|
||||
particular user, “normally used” refers to a typical or common use of
|
||||
that class of product, regardless of the status of the particular user or of the way
|
||||
in which the particular user actually uses, or expects or is expected to use, the
|
||||
product. A product is a consumer product regardless of whether the product has
|
||||
substantial commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install and execute
|
||||
modified versions of a covered work in that User Product from a modified version of
|
||||
its Corresponding Source. The information must suffice to ensure that the continued
|
||||
functioning of the modified object code is in no case prevented or interfered with
|
||||
solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for
|
||||
use in, a User Product, and the conveying occurs as part of a transaction in which
|
||||
the right of possession and use of the User Product is transferred to the recipient
|
||||
in perpetuity or for a fixed term (regardless of how the transaction is
|
||||
characterized), the Corresponding Source conveyed under this section must be
|
||||
accompanied by the Installation Information. But this requirement does not apply if
|
||||
neither you nor any third party retains the ability to install modified object code
|
||||
on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to
|
||||
continue to provide support service, warranty, or updates for a work that has been
|
||||
modified or installed by the recipient, or for the User Product in which it has been
|
||||
modified or installed. Access to a network may be denied when the modification itself
|
||||
materially and adversely affects the operation of the network or violates the rules
|
||||
and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with
|
||||
this section must be in a format that is publicly documented (and with an
|
||||
implementation available to the public in source code form), and must require no
|
||||
special password or key for unpacking, reading or copying.
|
||||
|
||||
### 7. Additional Terms
|
||||
|
||||
“Additional permissions” are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions. Additional
|
||||
permissions that are applicable to the entire Program shall be treated as though they
|
||||
were included in this License, to the extent that they are valid under applicable
|
||||
law. If additional permissions apply only to part of the Program, that part may be
|
||||
used separately under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any
|
||||
additional permissions from that copy, or from any part of it. (Additional
|
||||
permissions may be written to require their own removal in certain cases when you
|
||||
modify the work.) You may place additional permissions on material, added by you to a
|
||||
covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a
|
||||
covered work, you may (if authorized by the copyright holders of that material)
|
||||
supplement the terms of this License with terms:
|
||||
|
||||
* **a)** Disclaiming warranty or limiting liability differently from the terms of
|
||||
sections 15 and 16 of this License; or
|
||||
* **b)** Requiring preservation of specified reasonable legal notices or author
|
||||
attributions in that material or in the Appropriate Legal Notices displayed by works
|
||||
containing it; or
|
||||
* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that
|
||||
modified versions of such material be marked in reasonable ways as different from the
|
||||
original version; or
|
||||
* **d)** Limiting the use for publicity purposes of names of licensors or authors of the
|
||||
material; or
|
||||
* **e)** Declining to grant rights under trademark law for use of some trade names,
|
||||
trademarks, or service marks; or
|
||||
* **f)** Requiring indemnification of licensors and authors of that material by anyone
|
||||
who conveys the material (or modified versions of it) with contractual assumptions of
|
||||
liability to the recipient, for any liability that these contractual assumptions
|
||||
directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further
|
||||
restrictions” within the meaning of section 10. If the Program as you received
|
||||
it, or any part of it, contains a notice stating that it is governed by this License
|
||||
along with a term that is a further restriction, you may remove that term. If a
|
||||
license document contains a further restriction but permits relicensing or conveying
|
||||
under this License, you may add to a covered work material governed by the terms of
|
||||
that license document, provided that the further restriction does not survive such
|
||||
relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in
|
||||
the relevant source files, a statement of the additional terms that apply to those
|
||||
files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a
|
||||
separately written license, or stated as exceptions; the above requirements apply
|
||||
either way.
|
||||
|
||||
### 8. Termination
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under
|
||||
this License. Any attempt otherwise to propagate or modify it is void, and will
|
||||
automatically terminate your rights under this License (including any patent licenses
|
||||
granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a
|
||||
particular copyright holder is reinstated **(a)** provisionally, unless and until the
|
||||
copyright holder explicitly and finally terminates your license, and **(b)** permanently,
|
||||
if the copyright holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently
|
||||
if the copyright holder notifies you of the violation by some reasonable means, this
|
||||
is the first time you have received notice of violation of this License (for any
|
||||
work) from that copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of
|
||||
parties who have received copies or rights from you under this License. If your
|
||||
rights have been terminated and not permanently reinstated, you do not qualify to
|
||||
receive new licenses for the same material under section 10.
|
||||
|
||||
### 9. Acceptance Not Required for Having Copies
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the
|
||||
Program. Ancillary propagation of a covered work occurring solely as a consequence of
|
||||
using peer-to-peer transmission to receive a copy likewise does not require
|
||||
acceptance. However, nothing other than this License grants you permission to
|
||||
propagate or modify any covered work. These actions infringe copyright if you do not
|
||||
accept this License. Therefore, by modifying or propagating a covered work, you
|
||||
indicate your acceptance of this License to do so.
|
||||
|
||||
### 10. Automatic Licensing of Downstream Recipients
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license
|
||||
from the original licensors, to run, modify and propagate that work, subject to this
|
||||
License. You are not responsible for enforcing compliance by third parties with this
|
||||
License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an organization, or
|
||||
merging organizations. If propagation of a covered work results from an entity
|
||||
transaction, each party to that transaction who receives a copy of the work also
|
||||
receives whatever licenses to the work the party's predecessor in interest had or
|
||||
could give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if the predecessor
|
||||
has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or
|
||||
affirmed under this License. For example, you may not impose a license fee, royalty,
|
||||
or other charge for exercise of rights granted under this License, and you may not
|
||||
initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that any patent claim is infringed by making, using, selling, offering for sale, or
|
||||
importing the Program or any portion of it.
|
||||
|
||||
### 11. Patents
|
||||
|
||||
A “contributor” is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The work thus
|
||||
licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or
|
||||
controlled by the contributor, whether already acquired or hereafter acquired, that
|
||||
would be infringed by some manner, permitted by this License, of making, using, or
|
||||
selling its contributor version, but do not include claims that would be infringed
|
||||
only as a consequence of further modification of the contributor version. For
|
||||
purposes of this definition, “control” includes the right to grant patent
|
||||
sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license
|
||||
under the contributor's essential patent claims, to make, use, sell, offer for sale,
|
||||
import and otherwise run, modify and propagate the contents of its contributor
|
||||
version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent (such as an
|
||||
express permission to practice a patent or covenant not to sue for patent
|
||||
infringement). To “grant” such a patent license to a party means to make
|
||||
such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the
|
||||
Corresponding Source of the work is not available for anyone to copy, free of charge
|
||||
and under the terms of this License, through a publicly available network server or
|
||||
other readily accessible means, then you must either **(1)** cause the Corresponding
|
||||
Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or **(3)** arrange, in a manner consistent with
|
||||
the requirements of this License, to extend the patent license to downstream
|
||||
recipients. “Knowingly relying” means you have actual knowledge that, but
|
||||
for the patent license, your conveying the covered work in a country, or your
|
||||
recipient's use of the covered work in a country, would infringe one or more
|
||||
identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you
|
||||
convey, or propagate by procuring conveyance of, a covered work, and grant a patent
|
||||
license to some of the parties receiving the covered work authorizing them to use,
|
||||
propagate, modify or convey a specific copy of the covered work, then the patent
|
||||
license you grant is automatically extended to all recipients of the covered work and
|
||||
works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the
|
||||
scope of its coverage, prohibits the exercise of, or is conditioned on the
|
||||
non-exercise of one or more of the rights that are specifically granted under this
|
||||
License. You may not convey a covered work if you are a party to an arrangement with
|
||||
a third party that is in the business of distributing software, under which you make
|
||||
payment to the third party based on the extent of your activity of conveying the
|
||||
work, and under which the third party grants, to any of the parties who would receive
|
||||
the covered work from you, a discriminatory patent license **(a)** in connection with
|
||||
copies of the covered work conveyed by you (or copies made from those copies), or **(b)**
|
||||
primarily for and in connection with specific products or compilations that contain
|
||||
the covered work, unless you entered into that arrangement, or that patent license
|
||||
was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied
|
||||
license or other defenses to infringement that may otherwise be available to you
|
||||
under applicable patent law.
|
||||
|
||||
### 12. No Surrender of Others' Freedom
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise)
|
||||
that contradict the conditions of this License, they do not excuse you from the
|
||||
conditions of this License. If you cannot convey a covered work so as to satisfy
|
||||
simultaneously your obligations under this License and any other pertinent
|
||||
obligations, then as a consequence you may not convey it at all. For example, if you
|
||||
agree to terms that obligate you to collect a royalty for further conveying from
|
||||
those to whom you convey the Program, the only way you could satisfy both those terms
|
||||
and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
### 13. Use with the GNU Affero General Public License
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or
|
||||
combine any covered work with a work licensed under version 3 of the GNU Affero
|
||||
General Public License into a single combined work, and to convey the resulting work.
|
||||
The terms of this License will continue to apply to the part which is the covered
|
||||
work, but the special requirements of the GNU Affero General Public License, section
|
||||
13, concerning interaction through a network will apply to the combination as such.
|
||||
|
||||
### 14. Revised Versions of this License
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU
|
||||
General Public License from time to time. Such new versions will be similar in spirit
|
||||
to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that
|
||||
a certain numbered version of the GNU General Public License “or any later
|
||||
version” applies to it, you have the option of following the terms and
|
||||
conditions either of that numbered version or of any later version published by the
|
||||
Free Software Foundation. If the Program does not specify a version number of the GNU
|
||||
General Public License, you may choose any version ever published by the Free
|
||||
Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU
|
||||
General Public License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no
|
||||
additional obligations are imposed on any author or copyright holder as a result of
|
||||
your choosing to follow a later version.
|
||||
|
||||
### 15. Disclaimer of Warranty
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
|
||||
QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
### 16. Limitation of Liability
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
|
||||
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
|
||||
PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE
|
||||
OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
|
||||
WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
### 17. Interpretation of Sections 15 and 16
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be
|
||||
given local legal effect according to their terms, reviewing courts shall apply local
|
||||
law that most closely approximates an absolute waiver of all civil liability in
|
||||
connection with the Program, unless a warranty or assumption of liability accompanies
|
||||
a copy of the Program in return for a fee.
|
||||
|
||||
_END OF TERMS AND CONDITIONS_
|
||||
|
||||
## How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to
|
||||
the public, the best way to achieve this is to make it free software which everyone
|
||||
can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them
|
||||
to the start of each source file to most effectively state the exclusion of warranty;
|
||||
and each file should have at least the “copyright” line and a pointer to
|
||||
where the full notice is found.
|
||||
|
||||
New-Phone-Who-Dis (NPWD) Copyright (C) 2021 - Kidz, Chip, ROCKY_southpaw, Kire, TasoOneAsia
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
New-Phone-Who-Dis (NPWD) Copyright (C) 2021 - Kidz, Chip, ROCKY_southpaw, Kire, TasoOneAsia
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type 'show c' for details.
|
||||
|
||||
The hypothetical commands `show w` and `show c` should show the appropriate parts of
|
||||
the General Public License. Of course, your program's commands might be different;
|
||||
for a GUI interface, you would use an “about box”.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to
|
||||
sign a “copyright disclaimer” for the program, if necessary. For more
|
||||
information on this, and how to apply and follow the GNU GPL, see
|
||||
<<http://www.gnu.org/licenses/>>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may consider it
|
||||
more useful to permit linking proprietary applications with the library. If this is
|
||||
what you want to do, use the GNU Lesser General Public License instead of this
|
||||
License. But first, please read
|
||||
<<http://www.gnu.org/philosophy/why-not-lgpl.html>>.
|
||||
You shall not use any piece of this software in a commercial product / service
|
||||
You shall not resell this software
|
||||
You shall not provide any facility to install this particular software in a commercial product / service
|
||||
You are in no way allowed to redistribute this code until this private project has become public, unless given written consent by one of the copyright holders.
|
||||
This copyright should appear in every part of the project code
|
||||
@@ -1,66 +1,79 @@
|
||||
# New-Phone-Who-Dis (NPWD)
|
||||
# New Phone README TITLE
|
||||
|
||||
<img src="https://beta.iodine.gg/zVkK7.png" width="500" height="300" />
|
||||
TODO
|
||||
|
||||
NPWD is our current running project. Our team has been working on the project since August, 2020. This resource isn’t complete yet and currently has no ETA for release. Feel free to test it out in a dev environment by following the installation guide.
|
||||
## Production Server Installation
|
||||
|
||||
Written completely by the Project Error Dev Team in [React](https://reactjs.org/) with a [TypeScript](https://www.typescriptlang.org/) client/server environment.
|
||||
|
||||
## Project Error Discord
|
||||
### Configuration
|
||||
|
||||
- Join the [Discord](https://discord.gg/HYwBjTbAY5) to follow current development of the project.
|
||||
This resource is highly configurable through the [config.json](./config.json). This JSON file holds configuration for the phone itself, for the apps running on it and peripheral information.
|
||||
|
||||
## Documentation & Installation
|
||||
Below is the list of configuration options:
|
||||
|
||||
- [Project-Error Docs](https://docs.projecterror.dev/#/) contains all the information regarding this resource. Please consult it for installation, dependencies, and other important information.
|
||||
| Option | Default | Description |
|
||||
|--------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Locale | en | The language locale used by the app. See [fivem keybinds](https://docs.fivem.net/docs/game-references/controls/) for options |
|
||||
| KeyTogglePhone | 288 (F1) | The keybind to open and close the app. See [fivem keybinds](https://docs.fivem.net/docs/game-references/controls/) for options |
|
||||
| PhoneAsItem | false | whether or not the phone is an item in game |
|
||||
| SwimDestroy | false | whether or not the phone will have a chance to be destroyed while swimming |
|
||||
| RunRate | 10 | interval in seconds to check phone destruction |
|
||||
| DestoryChance | 100 | Percent chance that phone destruction will occur |
|
||||
| DestroyPhoneReCheck | 3 | Time in minutes before another phone destruction attempt will happen |
|
||||
| notificationPosition.horizontal | right | Horizontal position of phone notifications. `left`, `center` or `right` |
|
||||
| notificationPosition.vertical | bottom | Vertical positon of phone notifications. `top` or `bottom` |
|
||||
| twitter.showNotifications | true | Whether or not to show twitter notifications |
|
||||
| twitter.generateProfileNameFromUsers | true | Whether or not the server should automtically generate a player's profile name from their user in the database |
|
||||
| twitter.allowEdtiableProfileName | true | Whether or not players can edit their profile name |
|
||||
| twitter.allowDeleteTweets | true | Whether or not players can delete their own tweets |
|
||||
| twitter.allowReportTweets | true | Whether or not players can report tweets. Optional discord integration. |
|
||||
| twitter.characterLimit | 240 | Limit on how many characters tweets can contain |
|
||||
| twitter.enableAvatars | true | Whether or not player's can select avatars for their twitter profile |
|
||||
| twitter.enableEmojis | true | Whether or not player's can use emojis in tweets |
|
||||
| twitter.enableImages | true | Whether or not player's can add images to tweets (external URLs) |
|
||||
| twitter.maxImages | 3 | The maximum amount of images allowed in a tweet |
|
||||
|
||||
## Support
|
||||
### Discord
|
||||
|
||||
No support is being provided currently for the resource as it is still in an unfinished state.
|
||||
It is possible to perform discord integration with the phone. To configure discord add the following variables to your `server.cfg` file:
|
||||
|
||||
Should you encounter any issues, please do the following:
|
||||
```
|
||||
set discord_bot_token "YOUR_DISCORD_BOT_TOKEN"
|
||||
set discord_channel_id "YOUR_DISCORD_CHANNEL_ID"
|
||||
```
|
||||
|
||||
- Check the [Git Kraken](https://app.gitkraken.com/glo/board/X9YZ_x_SVQEcMwpH) to see if the issue you're referring to is already tracked.
|
||||
- Check the [State of Development](https://docs.projecterror.dev/#/npwd/state-of-dev?id=introduction) to see if the app is still a **WIP**.
|
||||
- If the issue isn't on the Git Kraken and the app is finished, please open an issue.
|
||||
- If the issue isn't on the Git Kraken and the app is **not** finished, please contact us in Discord.
|
||||
Current discord integrations with the phone:
|
||||
|
||||
We do not want issues opened that are due to the phone being **WIP** as this slows down development since we now have to address it more immediately.
|
||||
- Twitter: reporting tweets
|
||||
|
||||
## Preview
|
||||
|
||||
[Latest Teaser Video (October 28th)](https://streamable.com/f1ri9r)
|
||||
## Development
|
||||
|
||||
#### Apps (February 20th, 2021)
|
||||
This phone is a [React](https://reactjs.org/) project with a TypeScript client/server environment.
|
||||
|
||||
Most of these apps have UI that does **not** represent the final product and are subject to change.
|
||||
### Prerequisites
|
||||
|
||||
- [**Bank**](https://beta.iodine.gg/Eh53X.png)
|
||||
- [**Calculator**](https://beta.iodine.gg/s6VQV.png)
|
||||
- [**Camera**](https://beta.iodine.gg/vW0y9.png)
|
||||
- [**Contacts**](https://beta.iodine.gg/3fujR.png)
|
||||
- [**Marketplace**](https://beta.iodine.gg/5bUa8.png)
|
||||
- [**Messages**](https://beta.iodine.gg/S4Lia.png)
|
||||
- [**Notes**](https://beta.iodine.gg/qTkBb.png)
|
||||
- [**Phone**](https://beta.iodine.gg/z0ii9.png)
|
||||
- [**Settings**](https://beta.iodine.gg/mZAIt.png)
|
||||
- [**Twitter**](https://beta.iodine.gg/rQZFR.png)
|
||||
The development environment assumes you have the following prerequisites:
|
||||
|
||||
## License
|
||||
1. A windows environment and Powershell as your default terminal
|
||||
1. [Git for windows](https://git-scm.com/download/win) installed
|
||||
1. [LTS node.js](https://nodejs.org/en/about/releases/) installed
|
||||
1. [yarn](https://yarnpkg.com/) package manager installed (`npm install -g yarn`)
|
||||
1. A fivem environment that is set up according to the [setting up a server instructions](https://docs.fivem.net/docs/server-manual/setting-up-a-server/) from the fivem documentation
|
||||
|
||||
New-Phone-Who-Dis (NPWD)
|
||||
### Development Environment
|
||||
|
||||
Copyright (C) 2021 - Kidz, Chip, ROCKY_southpaw, Kire, TasoOneAsia
|
||||
#### Steps
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
1. Clone the repo into your `server-data/resources/[local]` folder
|
||||
1. Go into the react project: `cd phone`
|
||||
1. Install node dependencies: `yarn install`
|
||||
2. Install `lint-staged` globally `npm i -g lint-staged
|
||||
3. Add the `new-phone-who-dis` app to your `server.cfg`
|
||||
4. Start your fivem server
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
#### Development iteration cycle:
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
- If iterating on client/server Lua make your change and then `ensure new-phone-who-dis` in the fivem server terminal
|
||||
- If iteration on UI changes run the project with `yarn watch` which will monitor the JavaScript project and rebuild when you make code changes and then `ensure new-phone-who-dis` after making your change
|
||||
- Avoid commiting `index.html` as the development version overrides the production version
|
||||
@@ -1,37 +1,32 @@
|
||||
{
|
||||
"Locale": "en",
|
||||
"KeyTogglePhone": 288,
|
||||
"KeyTakeCall": 38,
|
||||
"PhoneAsItem": false,
|
||||
"SwimDestroy": false,
|
||||
"RunRate": 10,
|
||||
"DestoryChance": 100,
|
||||
"DestroyPhoneReCheck": 3,
|
||||
"notificationPosition": {
|
||||
"horizontal": "right",
|
||||
"vertical": "top"
|
||||
},
|
||||
"general": {
|
||||
"useDashNumber": true
|
||||
},
|
||||
"twitter": {
|
||||
"showNotifications": true,
|
||||
"generateProfileNameFromUsers": true,
|
||||
"allowEdtiableProfileName": true,
|
||||
"allowDeleteTweets": true,
|
||||
"allowReportTweets": true,
|
||||
"characterLimit": 160,
|
||||
"newLineLimit": 10,
|
||||
"enableAvatars": true,
|
||||
"enableEmojis": true,
|
||||
"enableImages": true,
|
||||
"maxImages": 3
|
||||
},
|
||||
"bank": {
|
||||
"showNotifications": true
|
||||
},
|
||||
"debug": {
|
||||
"level": "debug",
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
"Locale": "en",
|
||||
"KeyTogglePhone": 288,
|
||||
"KeyTakeCall": 38,
|
||||
"PhoneAsItem": false,
|
||||
"SwimDestroy": false,
|
||||
"RunRate": 10,
|
||||
"DestoryChance": 100,
|
||||
"DestroyPhoneReCheck": 3,
|
||||
"notificationPosition": {
|
||||
"horizontal": "right",
|
||||
"vertical": "top"
|
||||
},
|
||||
"general": {
|
||||
"useDashNumber": false
|
||||
},
|
||||
"twitter": {
|
||||
"showNotifications": true,
|
||||
"generateProfileNameFromUsers": true,
|
||||
"allowEdtiableProfileName": true,
|
||||
"allowDeleteTweets": true,
|
||||
"allowReportTweets": true,
|
||||
"characterLimit": 240,
|
||||
"enableAvatars": true,
|
||||
"enableEmojis": true,
|
||||
"enableImages": true,
|
||||
"maxImages": 3
|
||||
},
|
||||
"bank": {
|
||||
"showNotifications": true
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,24 @@
|
||||
fx_version "cerulean"
|
||||
fx_version "adamant"
|
||||
game "gta5"
|
||||
description 'js runtime monkaW'
|
||||
authors { "itschip", "erik-sn", "TasoOneAsia", "kidz", "RockySouthpaw"}
|
||||
description 'New-PHone-Who-Dis'
|
||||
author { "chip", "BTNGaming", "ROCKY_southpaw" }
|
||||
|
||||
client_script {
|
||||
'@es_extended/locale.lua',
|
||||
'resources/locales/*.lua',
|
||||
'resources/client/*lua',
|
||||
'resources/dist/client/*.client.js'
|
||||
}
|
||||
|
||||
shared_script {
|
||||
'resources/config.lua'
|
||||
}
|
||||
|
||||
server_script {
|
||||
"@mysql-async/lib/MySQL.lua",
|
||||
'@es_extended/locale.lua',
|
||||
'resources/locales/*.lua',
|
||||
'resources/server/*.lua',
|
||||
'resources/dist/server/*.server.js'
|
||||
}
|
||||
|
||||
@@ -16,6 +27,8 @@ ui_page 'resources/html/index.html'
|
||||
files {
|
||||
'resources/html/index.html',
|
||||
'resources/html/*.js',
|
||||
'resources/html/*.map',
|
||||
'resources/html/media/**/*'
|
||||
}
|
||||
'resources/html/media/frames/*.png',
|
||||
'resources/html/media/backgrounds/*.png',
|
||||
'resources/html/media/backgrounds/*.jpg',
|
||||
'resources/html/media/twitter/*'
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"packages": ["phone", "resources"],
|
||||
"version": "0.0.0",
|
||||
"npmClient": "yarn"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "npwd",
|
||||
"devDependencies": {
|
||||
"husky": "^5.1.3",
|
||||
"lerna": "^3.22.1",
|
||||
"prettier": "^2.2.1",
|
||||
"pretty-quick": "^3.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "lerna run build --concurrency 1",
|
||||
"prepare": "husky install",
|
||||
"format": "pretty-quick"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,8 @@
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-syntax-dynamic-import"]
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-syntax-dynamic-import"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
@@ -0,0 +1,2 @@
|
||||
build
|
||||
node_modules
|
||||
@@ -1,3 +1,2 @@
|
||||
# New Phone Who Dis
|
||||
|
||||
A FiveM phone created with ReactJS, with the power from TasoOneAsia, erik-sn (Kire), jfrader (kidz), r1OG, RockySouthpaw and itschip. Still missing commits from 99kr.
|
||||
A FiveM phone created with ReactJS, with the power from BTNGaming, kidz, ROCKY_shouthpaw and chip.
|
||||
@@ -1,58 +0,0 @@
|
||||
const {
|
||||
addAfterLoader,
|
||||
removeLoaders,
|
||||
loaderByName,
|
||||
getLoaders,
|
||||
throwUnexpectedConfigError,
|
||||
} = require('@craco/craco');
|
||||
|
||||
const throwError = (message) =>
|
||||
throwUnexpectedConfigError({
|
||||
packageName: 'craco',
|
||||
githubRepo: 'gsoft-inc/craco',
|
||||
message,
|
||||
githubIssueQuery: 'webpack',
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
webpack: {
|
||||
configure: (webpackConfig, { paths }) => {
|
||||
const { hasFoundAny, matches } = getLoaders(webpackConfig, loaderByName('babel-loader'));
|
||||
if (!hasFoundAny) throwError('failed to find babel-loader');
|
||||
|
||||
const { hasRemovedAny, removedCount } = removeLoaders(
|
||||
webpackConfig,
|
||||
loaderByName('babel-loader'),
|
||||
);
|
||||
if (!hasRemovedAny) throwError('no babel-loader to remove');
|
||||
if (removedCount !== 2) throwError('had expected to remove 2 babel loader instances');
|
||||
webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter(
|
||||
({ constructor: c }) => !c || c.name !== 'ModuleScopePlugin',
|
||||
);
|
||||
|
||||
const tsLoader = {
|
||||
test: /\.tsx?$/,
|
||||
loader: require.resolve('ts-loader'),
|
||||
options: { transpileOnly: true },
|
||||
};
|
||||
|
||||
const { isAdded: tsLoaderIsAdded } = addAfterLoader(
|
||||
webpackConfig,
|
||||
loaderByName('url-loader'),
|
||||
tsLoader,
|
||||
);
|
||||
|
||||
if (!tsLoaderIsAdded) throwError('failed to add ts-loader');
|
||||
|
||||
const { isAdded: babelLoaderIsAdded } = addAfterLoader(
|
||||
webpackConfig,
|
||||
loaderByName('ts-loader'),
|
||||
matches[1].loader, // babel-loader
|
||||
);
|
||||
|
||||
if (!babelLoaderIsAdded) throwError('failed to add back babel-loader for non-application JS');
|
||||
|
||||
return webpackConfig;
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
console.log(args);
|
||||
|
||||
const path = './src/locale/';
|
||||
|
||||
const langs = ['bs', 'no', 'es', 'fr', 'pt', 'ptbr', 'sv', 'tr'];
|
||||
|
||||
const defaultLang = 'en';
|
||||
|
||||
const langFiles = [];
|
||||
|
||||
let defaultLangFile;
|
||||
|
||||
const missingKeys = {};
|
||||
|
||||
const promises = langs
|
||||
.filter((l) => (args[0] ? args[0] === l : true))
|
||||
.map((l) => {
|
||||
return new Promise((res, rej) => {
|
||||
import(path + l + '.json')
|
||||
.then((module) => {
|
||||
langFiles.push(module.default.translation);
|
||||
res();
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
rej(e);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const Load = () => Promise.all(promises);
|
||||
|
||||
const LoadDefault = () =>
|
||||
new Promise((res, rej) => {
|
||||
import(path + defaultLang + '.json')
|
||||
.then((module) => {
|
||||
defaultLangFile = module.default.translation;
|
||||
res();
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
rej(e);
|
||||
});
|
||||
});
|
||||
|
||||
(async () => {
|
||||
const filteredLangs = langs.filter((l) => (args[0] ? args[0] === l : true));
|
||||
|
||||
await LoadDefault();
|
||||
await Load();
|
||||
let idx = 0;
|
||||
for (const file of langFiles) {
|
||||
const currLang = filteredLangs[idx];
|
||||
if (currLang === defaultLang) {
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
if (args[0] && args[0] !== currLang) {
|
||||
return;
|
||||
}
|
||||
missingKeys[currLang] = [];
|
||||
for (const dKey in defaultLangFile) {
|
||||
let exists = false;
|
||||
for (const key in file) {
|
||||
if (key === dKey) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
if (!exists) {
|
||||
missingKeys[currLang].push([dKey, defaultLangFile[dKey]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(missingKeys);
|
||||
})();
|
||||
@@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "npwd-nui",
|
||||
"name": "new-phone",
|
||||
"version": "0.1.0",
|
||||
"repository": "https://github.com/project-error/new-phone-who-dis",
|
||||
"private": false,
|
||||
"license": "CC-BY-NC-SA-4.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.4.4",
|
||||
"@fortawesome/fontawesome-free": "^5.15.1",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
||||
@@ -14,27 +13,25 @@
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "^4.0.0-alpha.56",
|
||||
"@popperjs/core": "^2.5.3",
|
||||
"@sentry/react": "^5.29.2",
|
||||
"@sentry/tracing": "^5.29.2",
|
||||
"core-js": "^3.8.3",
|
||||
"dayjs": "^1.10.4",
|
||||
"dompurify": "^2.2.6",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"@types/jest": "^26.0.14",
|
||||
"core-js": "^3.6.5",
|
||||
"emoji-mart": "^3.0.0",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
"howler": "^2.2.1",
|
||||
"i18next": "^19.7.0",
|
||||
"jsonschema": "^1.4.0",
|
||||
"parse-url": "^5.0.2",
|
||||
"qs": "^6.9.6",
|
||||
"prettier": "^2.0.5",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-hotkeys": "^2.0.0",
|
||||
"react-i18next": "^11.7.1",
|
||||
"react-popper": "^2.2.3",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "4.0.1",
|
||||
"recoil": "^0.1.2"
|
||||
"react-scripts": "3.4.3",
|
||||
"recoil": "^0.0.10",
|
||||
"styled-components": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.4",
|
||||
@@ -43,32 +40,21 @@
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/preset-env": "^7.4.5",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@craco/craco": "^6.1.1",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"@types/enzyme": "^3.10.7",
|
||||
"@types/howler": "^2.2.1",
|
||||
"@types/jest": "^26.0.14",
|
||||
"@types/node": "^14.11.5",
|
||||
"@types/qs": "^6.9.5",
|
||||
"@types/react": "^16.9.51",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
"@types/react-router-dom": "^5.1.7",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-styled-components": "^1.10.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||
"copy-webpack-plugin": "6.2.1",
|
||||
"cp-cli": "^2.0.0",
|
||||
"cra-build-watch": "^3.2.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^2.1.1",
|
||||
"customize-cra": "^1.0.0",
|
||||
"file-loader": "^3.0.1",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^4.3.0",
|
||||
"react-devtools": "^4.10.1",
|
||||
"ifdef-loader": "^2.1.5",
|
||||
"react-test-renderer": "^16.13.1",
|
||||
"style-loader": "^0.23.1",
|
||||
"svg-url-loader": "^2.3.2",
|
||||
@@ -79,13 +65,12 @@
|
||||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"scripts": {
|
||||
"i18n:missing": "node --experimental-json-modules i18n.missingKeys.js",
|
||||
"copy:config": "cp-cli ../config.json ./src/config.autogen.json",
|
||||
"start": "craco start",
|
||||
"start": "react-scripts start",
|
||||
"watch": "cra-build-watch --disable-chunks --build-path ../resources/html --output-filename dev.js",
|
||||
"build": "yarn copy:config && cross-env NODE_ENV=production webpack --config webpack/prod.config.js --color -p --progress --hide-modules --display-optimization-bailout",
|
||||
"build:dev": "cross-env NODE_ENV=development webpack --config webpack/dev.config.js --color -p --progress --hide-modules --display-optimization-bailout --analyze",
|
||||
"test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}",
|
||||
"format": "prettier --write src/**/*.{js,jsx,ts,tsx,json,css,scss,md}",
|
||||
"build": "react-scripts build",
|
||||
"build:resources": "cross-env NODE_ENV=production webpack --config webpack/webpack.resources.js --color -p --progress --hide-modules --display-optimization-bailout",
|
||||
"test": "react-scripts test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}",
|
||||
"test:watch": "react-scripts test --watchAll --testMatch **/src/**/*.test.{ts,js,tsx}",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Taso: Including some default values for clarity sake
|
||||
module.exports = {
|
||||
trailingComma: "es5",
|
||||
tabWidth: 2,
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
jsxSingleQuote: true,
|
||||
jsxBracketSameLine: false,
|
||||
bracketSpacing: true
|
||||
}
|
||||
@@ -2,13 +2,10 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||
/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Project Error - New Phone Who Dis</title>
|
||||
<title>ReIgnited React Phone</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
|
After Width: | Height: | Size: 381 KiB |
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 22 KiB |
@@ -1,12 +1,12 @@
|
||||
.PhoneWrapper {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Phone {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0vh;
|
||||
right: 0vh;
|
||||
width: 500px;
|
||||
height: 1000px;
|
||||
background-size: cover;
|
||||
@@ -24,6 +24,8 @@
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
background-color: black;
|
||||
border-left: 4px solid black;
|
||||
border-right: 4px solid black;
|
||||
bottom: 100px;
|
||||
left: 50px;
|
||||
right: 50px;
|
||||
@@ -33,7 +35,6 @@
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.PhoneAppContainer {
|
||||
@@ -48,12 +49,12 @@
|
||||
}
|
||||
*::-webkit-scrollbar-track {
|
||||
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
||||
background-color: #666;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
*::-webkit-scrollbar {
|
||||
width: 3px;
|
||||
background-color: transparent;
|
||||
}
|
||||
*::-webkit-scrollbar-thumb {
|
||||
background-color: #f5f5f5;
|
||||
background-color: #666;
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import React from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { shallow } from 'enzyme';
|
||||
import Phone from './Phone';
|
||||
import React from "react";
|
||||
import { RecoilRoot } from "recoil";
|
||||
import { shallow } from "enzyme";
|
||||
import Phone from "./Phone";
|
||||
|
||||
it('renders Phone', () => {
|
||||
it("renders Phone", () => {
|
||||
shallow(
|
||||
<RecoilRoot>
|
||||
<Phone />
|
||||
</RecoilRoot>,
|
||||
</RecoilRoot>
|
||||
);
|
||||
});
|
||||
@@ -1,11 +1,14 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import './Phone.css';
|
||||
import './i18n';
|
||||
import { Route } from 'react-router-dom';
|
||||
import { CallModal } from './os/call/components/CallModal';
|
||||
import { useSettings } from './apps/settings/hooks/useSettings';
|
||||
import MessageIcon from '@material-ui/icons/Email';
|
||||
import { CallModal } from './modal/components/CallModal';
|
||||
import { HomeApp } from './apps/home/components/Home';
|
||||
import { Box, Paper, Slide, Typography } from '@material-ui/core';
|
||||
import { useKeyboardService } from './os/keyboard/hooks/useKeyboardService';
|
||||
import { ThemeProvider } from '@material-ui/core';
|
||||
import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard';
|
||||
import { NotificationIcon } from './os/notifications/components/NotificationIcon';
|
||||
import { NotificationBar } from './os/notifications/components/NotificationBar';
|
||||
import { Navigation } from './os/navigation-bar/components/Navigation';
|
||||
import { useNuiService } from './os/nui-events/hooks/useNuiService';
|
||||
@@ -20,142 +23,305 @@ import { useBankService } from './apps/bank/hooks/useBankService';
|
||||
import { useMessagesService } from './apps/messages/hooks/useMessageService';
|
||||
import { useNotesService } from './apps/notes/hooks/useNotesService';
|
||||
import { usePhotoService } from './apps/camera/hooks/usePhotoService';
|
||||
import { isSettingsSchemaValid, useSettings } from './apps/settings/hooks/useSettings';
|
||||
import { useCallService } from './os/call/hooks/useCallService';
|
||||
import { useDialService } from './apps/dialer/hooks/useDialService';
|
||||
import InjectDebugData from './os/debug/InjectDebugData';
|
||||
import { usePhoneVisibility } from './os/phone/hooks/usePhoneVisibility';
|
||||
import { PhoneSnackbar } from './ui/components/PhoneSnackbar';
|
||||
import { NotificationAlert } from './os/notifications/components/NotificationAlert';
|
||||
import { useCallModal } from './os/call/hooks/useCallModal';
|
||||
import WindowSnackbar from './ui/components/WindowSnackbar';
|
||||
import Nui from './os/nui-events/utils/Nui';
|
||||
import { usePhone } from './os/phone/hooks/usePhone';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSnackbar } from './ui/hooks/useSnackbar';
|
||||
|
||||
// Inject mock data when in development env.
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'CAMERA',
|
||||
method: 'setPhotos',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
image: 'https://i.imgur.com/OO8wx6Z.jpg',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
image: 'https://i.imgur.com/pqGBiST.jpg',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'BANK',
|
||||
method: 'setCredentials',
|
||||
data: {
|
||||
name: 'Firstname Lastname',
|
||||
balance: 2000,
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'CONTACTS',
|
||||
method: 'setContacts',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
display: 'Ruqen',
|
||||
number: '43534444',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
display: 'Taso',
|
||||
number: '43534444',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'SIMCARD',
|
||||
method: 'setNumber',
|
||||
data: '111-1134',
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'NOTES',
|
||||
method: 'setNotes',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
title: 'First note',
|
||||
content: 'Hello, this is my shitty note',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'Second note',
|
||||
content: 'Hello, this is another shitty note',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'BANK',
|
||||
method: 'setNotification',
|
||||
data: {
|
||||
id: 1,
|
||||
message: 'ahhaha',
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
new MessageEvent('messsage', {
|
||||
data: {
|
||||
app: 'TWITTER',
|
||||
method: 'setNotification',
|
||||
data: {
|
||||
id: 1,
|
||||
message: 'ahhaha',
|
||||
},
|
||||
},
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'BANK',
|
||||
method: 'setTransaction',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
amount: 200,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
amount: 200,
|
||||
type: 'Withdraw',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
amount: 200,
|
||||
type: 'Withdraw',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
amount: 50,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
amount: 50,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
amount: 50,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent('message', {
|
||||
data: {
|
||||
app: 'SELLOUT',
|
||||
method: 'setListings',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Some guy',
|
||||
number: '123-4567',
|
||||
title: 'Car',
|
||||
category: 'CAR',
|
||||
description: 'Selling this cool car',
|
||||
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
||||
price: 400,
|
||||
posted: '1/9/2021',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Some other dude',
|
||||
number: '666-6666',
|
||||
title: 'Material',
|
||||
description:
|
||||
'Selling my wife olsdfjsdfk jfksdaj kasjfksf jdkasf jklasf jasklf jaskf',
|
||||
url: '',
|
||||
price: 30,
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function Phone() {
|
||||
const { t, i18n } = useTranslation();
|
||||
|
||||
const { apps } = useApps();
|
||||
|
||||
const [settings] = useSettings();
|
||||
|
||||
const { addAlert } = useSnackbar();
|
||||
|
||||
// Set language from local storage
|
||||
// This will only trigger on first mount & settings changes
|
||||
useEffect(() => {
|
||||
i18n.changeLanguage(settings.language.value).catch((e) => console.error(e));
|
||||
}, [i18n, settings.language]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isSettingsSchemaValid()) {
|
||||
addAlert({
|
||||
message: t('SETTINGS.MESSAGES.INVALID_SETTINGS'),
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
// We only want to run this on first mount of the phone,
|
||||
// so we leave an empty dep array. Otherwise, we hit a max depth error.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useNuiService();
|
||||
useKeyboardService();
|
||||
usePhoneService();
|
||||
const { visibility } = usePhone();
|
||||
const { settings, currentTheme } = useSettings();
|
||||
const { allApps } = useApps();
|
||||
useSimcardService();
|
||||
useContactsService();
|
||||
useTwitterService();
|
||||
useInitKeyboard();
|
||||
useSelloutService();
|
||||
useBankService();
|
||||
useMessagesService();
|
||||
useNotesService();
|
||||
usePhotoService();
|
||||
useCallService();
|
||||
useDialService();
|
||||
|
||||
const { modal: callModal } = useCallModal();
|
||||
const { bottom, visibility } = usePhoneVisibility();
|
||||
const { isPhoneReady } = usePhone();
|
||||
if (visibility === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const calling = false;
|
||||
|
||||
document.onkeyup = function (data) {
|
||||
if (data.which == 27) {
|
||||
Nui.send('phone:close');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<WindowSnackbar />
|
||||
<Slide direction="up" timeout={{ enter: 500, exit: 500 }} in={visibility}>
|
||||
<div className="PhoneWrapper">
|
||||
<div
|
||||
className="Phone"
|
||||
style={{
|
||||
position: 'fixed',
|
||||
transformOrigin: 'right bottom',
|
||||
transform: `scale(${settings.zoom.value}`,
|
||||
bottom,
|
||||
}}
|
||||
>
|
||||
<ThemeProvider theme={currentTheme()}>
|
||||
<div className='PhoneWrapper'>
|
||||
<div style={{ zoom: settings.zoom }}>
|
||||
<div className='Phone'>
|
||||
<div
|
||||
className="PhoneFrame"
|
||||
className='PhoneFrame'
|
||||
style={{
|
||||
backgroundImage: `url(media/frames/${settings.frame.value})`,
|
||||
backgroundImage: `url(./media/frames/${settings.frame})`,
|
||||
}}
|
||||
/>
|
||||
></div>
|
||||
<div
|
||||
id="phone"
|
||||
className="PhoneScreen"
|
||||
id='phone'
|
||||
className='PhoneScreen'
|
||||
style={{
|
||||
backgroundImage: `url(media/backgrounds/${settings.wallpaper.value})`,
|
||||
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
|
||||
}}
|
||||
>
|
||||
{isPhoneReady ? (
|
||||
<>
|
||||
<NotificationBar />
|
||||
<div className="PhoneAppContainer">
|
||||
<>
|
||||
<NotificationBar
|
||||
notifications={[
|
||||
{
|
||||
key: 'newMessage',
|
||||
icon: <NotificationIcon Icon={MessageIcon} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div className='PhoneAppContainer'>
|
||||
{calling ? (
|
||||
<CallModal />
|
||||
) : (
|
||||
<>
|
||||
<Route exact path="/" component={HomeApp} />
|
||||
{callModal && <Route exact path="/call" component={CallModal} />}
|
||||
{apps.map((App) => (
|
||||
<Route exact path='/' component={HomeApp} />
|
||||
|
||||
{allApps.map((App) => (
|
||||
<App.Route key={App.id} />
|
||||
))}
|
||||
</>
|
||||
<NotificationAlert />
|
||||
<PhoneSnackbar />
|
||||
</div>
|
||||
<Navigation />
|
||||
</>
|
||||
) : (
|
||||
<Box
|
||||
component={Paper}
|
||||
height="100%"
|
||||
width="100%"
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
>
|
||||
<Typography paragraph variant="h6">
|
||||
NPWD {t('INITIALIZING')}
|
||||
</Typography>
|
||||
<Typography paragraph>{t('GENERIC_WAIT')}</Typography>
|
||||
</Box>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
<Navigation />
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Slide>
|
||||
</div>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default Phone;
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: true,
|
||||
},
|
||||
{
|
||||
app: 'PHONE',
|
||||
method: 'setPhoneReady',
|
||||
data: true,
|
||||
},
|
||||
]);
|
||||
@@ -1,22 +0,0 @@
|
||||
import React from 'react';
|
||||
import { ThemeProvider } from '@material-ui/core';
|
||||
import { NotificationsProvider } from './os/notifications/providers/NotificationsProvider';
|
||||
import { usePhoneTheme } from './os/phone/hooks/usePhoneTheme';
|
||||
import SnackbarProvider from './ui/providers/SnackbarProvider';
|
||||
import Phone from './Phone';
|
||||
import { SoundProvider } from './os/sound/providers/SoundProvider';
|
||||
|
||||
export const PhoneContainer = () => {
|
||||
const currentTheme = usePhoneTheme();
|
||||
return (
|
||||
<ThemeProvider theme={currentTheme}>
|
||||
<SoundProvider>
|
||||
<NotificationsProvider>
|
||||
<SnackbarProvider>
|
||||
<Phone />
|
||||
</SnackbarProvider>
|
||||
</NotificationsProvider>
|
||||
</SoundProvider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');
|
||||
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");
|
||||
|
||||
/* #### Generated By: http://www.cufonfonts.com #### */
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Bahnschrift Regular'), url('../fonts/BAHNSCHRIFT.woff') format('woff');
|
||||
}
|
||||
}
|
||||
|
||||
#account-section,
|
||||
#transaction-section {
|
||||
font-family: 'Bahnschrift Regular';
|
||||
#account-section, #transaction-section {
|
||||
font-family: 'Bahnschrift Regular'
|
||||
}
|
||||
|
||||
#transaction-section .MuiTablePagination-root {
|
||||
@@ -27,10 +26,12 @@
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
|
||||
#bank-app .Mui-selected {
|
||||
color: #388cf8 !important;
|
||||
color: #388CF8 !important;
|
||||
}
|
||||
|
||||
|
||||
#bank-app .MuiSnackbar-root {
|
||||
position: absolute;
|
||||
}
|
||||
@@ -46,4 +47,4 @@
|
||||
|
||||
#actionButton a {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
@@ -1,73 +1,27 @@
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles, Paper, Typography } from '@material-ui/core';
|
||||
import { BankTitle } from './BankTitle';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { Button } from '../../../ui/components/Button';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useTransactions } from '../hooks/useTransactions';
|
||||
import './BankApp.css';
|
||||
import { TransferModal } from './transfers/TransferModal';
|
||||
|
||||
import { useBankModal } from '../hooks/useBankModal';
|
||||
import { useCredentials } from '../hooks/useCredentials';
|
||||
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
|
||||
// image
|
||||
import CreditCard from '../img/credit-card.png';
|
||||
import { NavigationBar } from './navigation/NavigationBar';
|
||||
|
||||
import { BankHome } from './home/BankHome';
|
||||
import { BankAccount } from './account/BankAccount';
|
||||
import { TransactionList } from './transactions/TransactionList';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
app: 'BANK',
|
||||
method: 'setCredentials',
|
||||
data: {
|
||||
name: 'Firstname Lastname',
|
||||
balance: 2000,
|
||||
},
|
||||
},
|
||||
{
|
||||
app: 'BANK',
|
||||
method: 'setTransaction',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
amount: 200,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
amount: 200,
|
||||
type: 'Withdraw',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
amount: 200,
|
||||
type: 'Withdraw',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
amount: 50,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
amount: 50,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
amount: 50,
|
||||
type: 'Deposit',
|
||||
source: 'chip',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
import { BankAlert } from './alert/BankAlert';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -95,20 +49,26 @@ const useStyles = makeStyles((theme) => ({
|
||||
}));
|
||||
|
||||
export const BankApp = () => {
|
||||
const { showBankModal } = useBankModal();
|
||||
const { showBankModal, setShowBankModal } = useBankModal();
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
|
||||
const openTransactionsModal = () => {
|
||||
setShowBankModal(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<AppWrapper id="bank-app">
|
||||
<AppWrapper id='bank-app'>
|
||||
<BankTitle />
|
||||
<TransferModal />
|
||||
<div className={showBankModal ? classes.backgroundModal : undefined} />
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route path="/bank" exact component={BankHome} />
|
||||
<Route path="/bank/account" exact component={BankAccount} />
|
||||
<Route path="/bank/transactions" exact component={TransactionList} />
|
||||
<Route path='/bank' exact component={BankHome} />
|
||||
<Route path='/bank/account' exact component={BankAccount} />
|
||||
<Route path='/bank/transactions' exact component={TransactionList} />
|
||||
</Switch>
|
||||
<BankAlert />
|
||||
</AppContent>
|
||||
<NavigationBar />
|
||||
</AppWrapper>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import { Typography, makeStyles } from '@material-ui/core';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
|
||||
import './BankApp.css';
|
||||
|
||||
@@ -23,8 +24,8 @@ const useStyles = makeStyles((theme) => ({
|
||||
export const BankTitle = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper className={classes.root} square variant="outlined" elevation={24}>
|
||||
<Typography id="bank-title" style={{ margin: 0 }} variant="h4">
|
||||
<Paper className={classes.root} square variant='outlined' elevation={24}>
|
||||
<Typography id='bank-title' style={{ margin: 0 }} variant='h4'>
|
||||
WhoDis Banking
|
||||
</Typography>
|
||||
</Paper>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@material-ui/core';
|
||||
import { makeStyles, Paper, Typography, Button } from '@material-ui/core';
|
||||
import { useTransactions } from '../../hooks/useTransactions';
|
||||
import useStyles from './account.styles';
|
||||
|
||||
@@ -13,13 +13,15 @@ export const AccountTransactions = (): any => {
|
||||
Transfer: classes.depositType,
|
||||
};
|
||||
|
||||
const transactionList = useTransactions();
|
||||
const { transactionList } = useTransactions();
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div id="account-section">
|
||||
<div id='account-section'>
|
||||
<div className={classes.header}>
|
||||
<h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2>
|
||||
<Button className={classes.seeAll}>{t('APPS_BANK_ACCOUNT_SEE_TRANSACTION')}</Button>
|
||||
<Button className={classes.seeAll}>
|
||||
{t('APPS_BANK_ACCOUNT_SEE_TRANSACTION')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={classes.transcationDiv}>
|
||||
@@ -31,7 +33,7 @@ export const AccountTransactions = (): any => {
|
||||
</div>
|
||||
<div>
|
||||
<p className={TransactionTypes[transaction.type]}>
|
||||
{transaction.type === 'Withdraw' ? '-' : '+'}
|
||||
{transaction.type == 'Withdraw' ? '-' : '+'}
|
||||
{transaction.amount}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { Button } from '../../../../ui/components/Button';
|
||||
import { makeStyles, Paper, Typography } from '@material-ui/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BankCard } from './BankCard';
|
||||
import { AccountTransactions } from './AccountTransactions';
|
||||
@@ -18,14 +19,18 @@ const useStyles = makeStyles((theme) => ({
|
||||
|
||||
export const BankAccount = () => {
|
||||
const classes = useStyles();
|
||||
const credentials = useCredentials();
|
||||
const { credentials } = useCredentials();
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<div>
|
||||
<h1 className={classes.title}>{t('APPS_BANK_ACCOUNT_TITLE')}</h1>
|
||||
</div>
|
||||
<BankCard name={credentials.name} account="Checking" balance={credentials.balance} />
|
||||
<BankCard
|
||||
name={credentials.name}
|
||||
account='Checking'
|
||||
balance={credentials.balance}
|
||||
/>
|
||||
<AccountTransactions />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from "react";
|
||||
import MuiAlert from "@material-ui/lab/Alert";
|
||||
|
||||
export function Alert(props) {
|
||||
return <MuiAlert elevation={6} variant="filled" {...props} />;
|
||||
}
|
||||
|
||||
export default Alert;
|
||||
@@ -0,0 +1,43 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useBankAlert } from '../../hooks/useBankAlert';
|
||||
import Snackbar from '@material-ui/core/Snackbar';
|
||||
import Alert from './Alert';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const BankAlert = () => {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const { bankAlert, setBankAlert } = useBankAlert();
|
||||
const [message, setMessage] = useState(null);
|
||||
const [severity, setSeverity] = useState('');
|
||||
|
||||
const _handleClose = () => {
|
||||
setOpen(false);
|
||||
setBankAlert(null);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (bankAlert === true) {
|
||||
setOpen(true);
|
||||
setMessage(t('APPS_BANK_ALERT_TRANSFER_SUCCESS'));
|
||||
setSeverity('success');
|
||||
} else if (bankAlert === false) {
|
||||
setOpen(true);
|
||||
setMessage(t('APPS_BANK_ALERT_TRANSFER_FAILURE'));
|
||||
setSeverity('error');
|
||||
}
|
||||
}, [bankAlert]);
|
||||
|
||||
return (
|
||||
<Snackbar
|
||||
style={{ width: '80%' }}
|
||||
open={open}
|
||||
autoHideDuration={6000}
|
||||
onClose={_handleClose}
|
||||
>
|
||||
<Alert onClose={_handleClose} severity={severity}>
|
||||
{message}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
);
|
||||
};
|
||||
@@ -12,7 +12,7 @@ import useStyles from './home.styles';
|
||||
export const BankHome = () => {
|
||||
const classes = useStyles();
|
||||
const { setShowBankModal } = useBankModal();
|
||||
const credentials = useCredentials();
|
||||
const { credentials } = useCredentials();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const openTransactionsModal = () => {
|
||||
@@ -24,17 +24,21 @@ export const BankHome = () => {
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Typography className={classes.headTitle}>
|
||||
<span style={{ fontWeight: 'bold' }}>{t('APPS_BANK_HOME_TITLE')}</span>, {credentials.name}
|
||||
<span style={{ fontWeight: 'bold' }}>{t('APPS_BANK_HOME_TITLE')}</span>,{' '}
|
||||
{credentials.name}
|
||||
</Typography>
|
||||
<div className={classes.accounts}>
|
||||
<h2 className={classes.accountsType}>Checking:</h2>
|
||||
<p className={classes.accountBalance}>{credentials.balance}</p>
|
||||
</div>
|
||||
<div className={classes.actions}>
|
||||
<Button id="actionButton" className={classes.actionButton}>
|
||||
<NavLink to="/bank/account">{t('APPS_BANK_ACCOUNT_LINK')}</NavLink>
|
||||
<Button id='actionButton' className={classes.actionButton}>
|
||||
<NavLink to='/bank/account'>{t('APPS_BANK_ACCOUNT_LINK')}</NavLink>
|
||||
</Button>
|
||||
<Button onClick={openTransactionsModal} className={classes.actionButton}>
|
||||
<Button
|
||||
onClick={openTransactionsModal}
|
||||
className={classes.actionButton}
|
||||
>
|
||||
{t('APPS_BANK_ACTIONS_TRANSFER')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,11 @@ import { Link } from 'react-router-dom';
|
||||
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faHome, faList, faMoneyCheck } from '@fortawesome/free-solid-svg-icons';
|
||||
import {
|
||||
faHome,
|
||||
faList,
|
||||
faMoneyCheck,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -33,17 +37,17 @@ export const NavigationBar = () => {
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faHome} />}
|
||||
to="/bank"
|
||||
to='/bank'
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faMoneyCheck} />}
|
||||
to="/bank/account"
|
||||
to='/bank/account'
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faList} />}
|
||||
to="/bank/transactions"
|
||||
to='/bank/transactions'
|
||||
/>
|
||||
</BottomNavigation>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import Notification from '../../../../ui/components/Notification';
|
||||
import { usePhone } from '../../../../os/phone/hooks/usePhone';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import useStyles from './notification.style';
|
||||
import { useBankNotification } from '../../hooks/useBankNotification';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faWonSign } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
export const BankNotification = () => {
|
||||
const { notification } = useBankNotification();
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const { config } = usePhone();
|
||||
|
||||
useEffect(() => {
|
||||
if (notification) {
|
||||
setVisible(true);
|
||||
}
|
||||
}, [notification?.id]);
|
||||
|
||||
if (!config?.bank.showNotifications || !notification) return null;
|
||||
|
||||
return (
|
||||
<Notification
|
||||
key={notification.id}
|
||||
open={visible}
|
||||
handleClose={() => setVisible(false)}
|
||||
>
|
||||
<div className={classes.content}>
|
||||
<div className={classes.title}>
|
||||
<div className={classes.titleLeft}>
|
||||
<div className={classes.icon}>
|
||||
<FontAwesomeIcon icon={faWonSign} />
|
||||
</div>
|
||||
<div className={classes.heading}>{notification.type}</div>
|
||||
</div>
|
||||
<div className={classes.justNow}>{t('APPS_BANK_TIME_JUST_NOW')}</div>
|
||||
</div>
|
||||
<div className={classes.message}>
|
||||
{notification.source} sent you ${notification.transferAmount}.{' '}
|
||||
<br></br> {notification.message}
|
||||
</div>
|
||||
</div>
|
||||
</Notification>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
content: {
|
||||
padding: theme.spacing(2),
|
||||
overflowY: 'hidden',
|
||||
},
|
||||
title: {
|
||||
display: 'flex',
|
||||
flexFlow: 'row nowrap',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
},
|
||||
titleLeft: {
|
||||
display: 'flex',
|
||||
flexFlow: 'row nowrap',
|
||||
justifyContent: 'flex-start',
|
||||
alignItems: 'center',
|
||||
},
|
||||
icon: {
|
||||
marginTop: '3px',
|
||||
marginRight: '5px',
|
||||
},
|
||||
heading: {
|
||||
marginBottom: '3px',
|
||||
},
|
||||
justNow: {
|
||||
fontSize: '18px',
|
||||
fontStyle: 'italic',
|
||||
paddingRight: '3px',
|
||||
},
|
||||
message: {
|
||||
fontSize: '16px',
|
||||
overflow: 'hidden',
|
||||
display: '-webkit-box',
|
||||
WebkitLineClamp: 2,
|
||||
WebkitBoxOrient: 'vertical',
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
export default useStyles;
|
||||
@@ -5,7 +5,7 @@ import TablePagination from '@material-ui/core/TablePagination';
|
||||
import { useTransactions } from '../../hooks/useTransactions';
|
||||
|
||||
export const TransactionList = () => {
|
||||
const transactionList = useTransactions();
|
||||
const { transactionList } = useTransactions();
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
const [page, setPage] = useState(0);
|
||||
@@ -27,7 +27,7 @@ export const TransactionList = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div id="transaction-section">
|
||||
<div id='transaction-section'>
|
||||
<div className={classes.header}>
|
||||
<h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2>
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@ export const TransactionList = () => {
|
||||
</div>
|
||||
<div>
|
||||
<p className={TransactionTypes[transaction.type]}>
|
||||
{transaction.type === 'Withdraw' ? '-' : '+'}
|
||||
{transaction.type == 'Withdraw' ? '-' : '+'}
|
||||
{transaction.amount}
|
||||
</p>
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@ export const TransactionList = () => {
|
||||
<TablePagination
|
||||
rowsPerPageOptions={[3, 5]}
|
||||
className={classes.pagination}
|
||||
component="div"
|
||||
component='div'
|
||||
count={transactionList.length}
|
||||
rowsPerPage={rowsPerPage}
|
||||
page={page}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import React, { useState } from 'react';
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import { Button, List, ListItem, TextField, makeStyles } from '@material-ui/core';
|
||||
import {
|
||||
Button,
|
||||
List,
|
||||
ListItem,
|
||||
TextField,
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
import { useBankModal } from '../../hooks/useBankModal';
|
||||
import { BankEvents } from '../../../../../../typings/bank';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
input: {
|
||||
@@ -27,6 +33,11 @@ const useStyles = makeStyles((theme) => ({
|
||||
fontSize: 16,
|
||||
marginBottom: 30,
|
||||
},
|
||||
closeButton: {
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
width: '10%',
|
||||
},
|
||||
}));
|
||||
|
||||
export const TransferModal = () => {
|
||||
@@ -44,7 +55,7 @@ export const TransferModal = () => {
|
||||
|
||||
const addTransfer = () => {
|
||||
const transferAmount = parseInt(amount);
|
||||
Nui.send(BankEvents.ADD_TRANSFER, {
|
||||
Nui.send('phone:addTransfer', {
|
||||
targetID,
|
||||
transferAmount,
|
||||
message,
|
||||
@@ -54,13 +65,16 @@ export const TransferModal = () => {
|
||||
|
||||
return (
|
||||
<Modal visible={showBankModal} handleClose={_handleClose}>
|
||||
<Button className={classes.closeButton} onClick={_handleClose}>
|
||||
<CloseIcon />
|
||||
</Button>
|
||||
<List style={{ marginTop: 20 }}>
|
||||
<ListItem>
|
||||
<TextField
|
||||
inputProps={{ className: classes.modalInputCenter }}
|
||||
fullWidth
|
||||
type="number"
|
||||
placeholder="ID"
|
||||
type='number'
|
||||
placeholder='ID'
|
||||
value={targetID}
|
||||
onChange={(e) => setTargetID(e.target.value)}
|
||||
/>
|
||||
@@ -68,9 +82,9 @@ export const TransferModal = () => {
|
||||
<ListItem>
|
||||
<TextField
|
||||
inputProps={{ className: classes.modalInputCenter }}
|
||||
placeholder="Amount"
|
||||
placeholder='Amount'
|
||||
fullWidth
|
||||
type="number"
|
||||
type='number'
|
||||
value={amount}
|
||||
onChange={(e) => setAmount(e.target.value)}
|
||||
/>
|
||||
@@ -78,7 +92,7 @@ export const TransferModal = () => {
|
||||
<ListItem>
|
||||
<TextField
|
||||
inputProps={{ className: classes.modalInput }}
|
||||
placeholder="Message"
|
||||
placeholder='Message'
|
||||
fullWidth
|
||||
value={message}
|
||||
multiline
|
||||
|
||||
@@ -3,18 +3,22 @@ import { atom } from 'recoil';
|
||||
export const bankState = {
|
||||
transactions: atom({
|
||||
key: 'transactionList',
|
||||
default: [],
|
||||
default: []
|
||||
}),
|
||||
bankModal: atom({
|
||||
key: 'modalVisibility',
|
||||
default: false,
|
||||
}),
|
||||
transferSuccessful: atom({
|
||||
key: 'bankAlert',
|
||||
default: null
|
||||
}),
|
||||
bankCredentials: atom({
|
||||
key: 'bankCredentails',
|
||||
default: null,
|
||||
default: null
|
||||
}),
|
||||
notification: atom({
|
||||
key: 'bankNotification',
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
default: null
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { bankState } from './state';
|
||||
|
||||
export const useBankAlert = (): any => {
|
||||
const [ bankAlert, setBankAlert ] = useRecoilState(bankState.transferSuccessful);
|
||||
return { bankAlert, setBankAlert };
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { bankState } from './state';
|
||||
|
||||
interface BankModalProps {
|
||||
showBankModal: boolean;
|
||||
setShowBankModal: (show: boolean) => void;
|
||||
}
|
||||
|
||||
export const useBankModal = (): BankModalProps => {
|
||||
const [showBankModal, setShowBankModal] = useRecoilState(bankState.bankModal);
|
||||
export const useBankModal = () => {
|
||||
const [ showBankModal, setShowBankModal ] = useRecoilState(bankState.bankModal);
|
||||
return { showBankModal, setShowBankModal };
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { Transfer } from '../../../../../typings/bank';
|
||||
import { Transfer } from '../../../common/typings/bank';
|
||||
import { bankState } from './state';
|
||||
|
||||
export const useBankNotification = () => {
|
||||
return useRecoilValue<Transfer | null>(bankState.notification);
|
||||
interface IBankNotification {
|
||||
notification: Transfer | null;
|
||||
}
|
||||
|
||||
export const useBankNotification = (): IBankNotification => {
|
||||
const notification = useRecoilValue<Transfer | null>(bankState.notification);
|
||||
return { notification };
|
||||
};
|
||||
@@ -1,29 +1,22 @@
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { bankState } from './state';
|
||||
import { useTransactions } from './useTransactions';
|
||||
import { useTransactions } from './useTransactions'
|
||||
import { useCredentials } from './useCredentials';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useBankAlert } from './useBankAlert';
|
||||
import { useSetRecoilState } from 'recoil'
|
||||
import { useBankNotification } from './useBankNotification';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const useBankService = () => {
|
||||
const setTransaction = useSetRecoilState(bankState.transactions);
|
||||
const setCredentials = useSetRecoilState(bankState.bankCredentials);
|
||||
const setTransaction = useSetRecoilState(bankState.transactions)
|
||||
const setCredentials = useSetRecoilState(bankState.bankCredentials)
|
||||
const setAlertMessage = useSetRecoilState(bankState.transferSuccessful)
|
||||
const setNotification = useSetRecoilState(bankState.notification);
|
||||
const { addAlert } = useSnackbar();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleAddAlert = ({ message, type }: IAlert) => {
|
||||
addAlert({
|
||||
message: t(`APPS_${message}`),
|
||||
type,
|
||||
});
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
useNuiEvent('BANK', 'setTransaction', setTransaction);
|
||||
useNuiEvent('BANK', 'setCredentials', setCredentials);
|
||||
useNuiEvent('BANK', 'setAlert', handleAddAlert);
|
||||
useNuiEvent('BANK', 'setAlert', setAlertMessage);
|
||||
useNuiEvent('BANK', 'setNotification', setNotification);
|
||||
return { useTransactions, useCredentials, useBankNotification };
|
||||
};
|
||||
return { useTransactions, useCredentials, useBankAlert, useBankNotification };
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { bankState } from './state';
|
||||
import { IBankCredentials } from '../../../../../typings/bank';
|
||||
import { IBankCredentials } from '../../../common/typings/bank';
|
||||
|
||||
export const useCredentials = () => {
|
||||
return useRecoilValue<IBankCredentials>(bankState.bankCredentials);
|
||||
interface ICredentialsHook {
|
||||
credentials: IBankCredentials;
|
||||
}
|
||||
|
||||
export const useCredentials = (): ICredentialsHook => {
|
||||
const credentials = useRecoilValue(bankState.bankCredentials);
|
||||
return { credentials };
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { ITransactions } from '../../../../../typings/bank';
|
||||
import { bankState } from './state';
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { bankState } from './state';
|
||||
|
||||
export const useTransactions = () => {
|
||||
return useRecoilValue<ITransactions[]>(bankState.transactions);
|
||||
const transactionList = useRecoilValue(bankState.transactions);
|
||||
return { transactionList };
|
||||
};
|
||||
@@ -1,10 +1,6 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import React from 'react';
|
||||
import { useCalculator, CalcButton } from '../hooks/useCalculator';
|
||||
import { Grid, makeStyles, Box, Paper, Fab } from '@material-ui/core';
|
||||
import { setClipboard } from '../../../os/phone/hooks/useClipboard';
|
||||
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
||||
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Grid, makeStyles, Box, Paper } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
button: {
|
||||
@@ -16,12 +12,6 @@ const useStyles = makeStyles((theme) => ({
|
||||
textAlign: 'right',
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
position: 'relative',
|
||||
},
|
||||
copyFab: {
|
||||
position: 'absolute',
|
||||
top: '16px',
|
||||
left: '16px',
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -47,43 +37,17 @@ export const Calculator = ({ ...props }) => {
|
||||
eight,
|
||||
nine,
|
||||
} = useCalculator();
|
||||
|
||||
const { addAlert } = useSnackbar();
|
||||
|
||||
const classes = useStyles();
|
||||
const resultStr = useMemo(
|
||||
() =>
|
||||
result().toLocaleString(undefined, {
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 4,
|
||||
}),
|
||||
[result],
|
||||
);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Box display="flex" flexDirection="column">
|
||||
<Box display='flex' flexDirection='column'>
|
||||
<Box flexGrow={1} component={Paper} p={4} className={classes.result}>
|
||||
<Fab
|
||||
size="small"
|
||||
onClick={() => {
|
||||
setClipboard(resultStr);
|
||||
addAlert({
|
||||
message: t('GENERIC_WRITE_TO_CLIPBOARD_MESSAGE', {
|
||||
content: 'number',
|
||||
}),
|
||||
type: 'success',
|
||||
});
|
||||
}}
|
||||
className={classes.copyFab}
|
||||
>
|
||||
<FileCopyIcon />
|
||||
</Fab>
|
||||
{resultStr}
|
||||
{result().toLocaleString(undefined, {
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 4,
|
||||
})}
|
||||
</Box>
|
||||
<Box>
|
||||
<Grid container justify="space-around">
|
||||
<Grid container justify='space-around'>
|
||||
<CalcButton button={clear} className={classes.button} />
|
||||
<CalcButton button={clearAll} className={classes.button} />
|
||||
<CalcButton button={divider} className={classes.button} />
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { Calculator } from './Calculator';
|
||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import React from "react";
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { Calculator } from "./Calculator";
|
||||
import { useApp } from "../../../os/apps/hooks/useApps";
|
||||
|
||||
export const CalculatorApp = () => {
|
||||
const calculator = useApp('CALCULATOR');
|
||||
const calculator = useApp("CALCULATOR");
|
||||
return (
|
||||
<AppWrapper>
|
||||
<AppTitle app={calculator} />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { SvgIcon, SvgIconProps } from '@material-ui/core';
|
||||
import React from "react";
|
||||
import { SvgIcon } from "@material-ui/core";
|
||||
|
||||
export const CalculatorIcon = ({ ...props }: SvgIconProps) => {
|
||||
export const CalculatorIcon = ({ ...props }) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<svg
|
||||
|
||||
@@ -1,39 +1,30 @@
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import React from 'react'
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { usePhotoModal } from '../hooks/usePhotoModal';
|
||||
import { GalleryGrid } from './grid/GalleryGrid';
|
||||
import { GalleryModal } from './modal/GalleryModal';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
app: 'CAMERA',
|
||||
method: 'setPhotos',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
image: 'https://beta.iodine.gg/noDcb.jpeg',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image: 'https://beta.iodine.gg/teUcY.jpeg',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const CameraApp = () => {
|
||||
|
||||
const {modal} = usePhotoModal();
|
||||
|
||||
return (
|
||||
<AppWrapper id="camera-app">
|
||||
<AppWrapper id='camera-app'>
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route path="/camera" exact component={GalleryGrid} />
|
||||
<Route path="/camera/image" exact component={GalleryModal} />
|
||||
</Switch>
|
||||
<GalleryModal />
|
||||
{/*<Router>
|
||||
<Switch>
|
||||
<Route path="/camera/image" component={GalleryModal} />
|
||||
<Route path="/" exact component={GalleryGrid} />
|
||||
</Switch>
|
||||
</Router>*/}
|
||||
{!modal ? <GalleryGrid /> : null}
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default CameraApp;
|
||||
@@ -1,57 +1,62 @@
|
||||
import React from 'react';
|
||||
import React from 'react'
|
||||
import { Box, Button } from '@material-ui/core';
|
||||
import useStyles from './grid.styles';
|
||||
import { usePhotos } from '../../hooks/usePhotos';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||
import { addQueryToLocation } from '../../../../common/utils/addQueryToLocation';
|
||||
import { getLocationFromUrl } from '../../../../common/utils/getLocationFromUrl';
|
||||
import { PhotoEvents } from '../../../../../../typings/photo';
|
||||
import { usePhotoModal } from '../../hooks/usePhotoModal';
|
||||
import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
||||
import { useModal } from '../../../contacts/hooks/useModal';
|
||||
//import { useHistory } from 'react-router-dom';
|
||||
|
||||
export const GalleryGrid = () => {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
const query = useQueryParams();
|
||||
|
||||
const referal = query.referal ? decodeURIComponent(query.referal) : '/camera/image';
|
||||
// isMessage will work as a style handler kinda. If the gallery is rendered in the messages,
|
||||
// it will have the value true, which basically means a tweak on the design to fit in a modal
|
||||
export const GalleryGrid = (isMessags) => {
|
||||
const classes = useStyles()
|
||||
|
||||
const { setMeta } = usePhotoMeta();
|
||||
const { setModal } = usePhotoModal();
|
||||
|
||||
//let history = useHistory();
|
||||
|
||||
const photos = usePhotos();
|
||||
|
||||
console.log(photos)
|
||||
|
||||
const handleCamera = () => {
|
||||
Nui.send(PhotoEvents.TAKE_PHOTO, {});
|
||||
};
|
||||
Nui.send('phone:TakePhoto', {})
|
||||
}
|
||||
|
||||
const handlePhotoOpen = (photo) => {
|
||||
history.push(addQueryToLocation(getLocationFromUrl(referal), 'image', photo.image));
|
||||
};
|
||||
setModal(true)
|
||||
setMeta(photo)
|
||||
//history.push('/camera/image')
|
||||
}
|
||||
|
||||
if (!photos)
|
||||
return (
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
if(!photos) return (
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
<Box>
|
||||
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
|
||||
<AddIcon fontSize="large" />
|
||||
<AddIcon fontSize="large"/>
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
<Box>
|
||||
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
|
||||
<AddIcon fontSize="large" />
|
||||
<AddIcon fontSize="large"/>
|
||||
</Button>
|
||||
</Box>
|
||||
{photos.map((photo) => (
|
||||
<Box key={photo.id} onClick={() => handlePhotoOpen(photo)}>
|
||||
{photos.map(photo => (
|
||||
<Box onClick={() => handlePhotoOpen(photo)}>
|
||||
<div style={{ backgroundImage: `url(${photo.image})` }} className={classes.photo} />
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
root: {
|
||||
flexGrow: 1,
|
||||
flexGrow: 1
|
||||
},
|
||||
photo: {
|
||||
border: '1px inset #fff',
|
||||
@@ -13,7 +13,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundPosition: 'center',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
backgroundSize: 'cover',
|
||||
},
|
||||
}));
|
||||
}
|
||||
}))
|
||||
|
||||
export default useStyles;
|
||||
export default useStyles;
|
||||
@@ -1,64 +1,62 @@
|
||||
import React, { useMemo, useState, useCallback } from 'react';
|
||||
import React from 'react'
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import { usePhotoMeta } from '../../hooks/usePhotoMeta';
|
||||
import { usePhotoModal } from '../../hooks/usePhotoModal';
|
||||
import useStyles from './modal.styles';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { Button, Paper } from '@material-ui/core';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
import DeleteIcon from '@material-ui/icons/Delete';
|
||||
import ShareIcon from '@material-ui/icons/Share';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||
import { ICameraPhoto } from '../../hooks/usePhotos';
|
||||
import { useShareModal } from '../../hooks/useShareModal';
|
||||
import { ShareModal } from './ShareModal';
|
||||
import { PhotoEvents } from '../../../../../../typings/photo';
|
||||
import { useShareLink } from '../../hooks/useShareLink';
|
||||
|
||||
export const GalleryModal = () => {
|
||||
|
||||
const { meta, setMeta } = usePhotoMeta();
|
||||
const { modal, setModal } = usePhotoModal();
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
const query = useQueryParams();
|
||||
const referal = query.referal || '/camera';
|
||||
|
||||
const [shareOpen, setShareOpen] = useState(null);
|
||||
const { shareModal ,setShareModal } = useShareModal();
|
||||
const { setShareLink } = useShareLink();
|
||||
|
||||
const meta: ICameraPhoto = useMemo(
|
||||
() => ({ id: query.id as string, image: query.image as string }),
|
||||
[query],
|
||||
);
|
||||
|
||||
const _handleClose = () => {
|
||||
history.push(referal);
|
||||
};
|
||||
setModal(false)
|
||||
setMeta(null);
|
||||
}
|
||||
|
||||
const handleDeletePhoto = () => {
|
||||
Nui.send(PhotoEvents.DELETE_PHOTO, {
|
||||
image: meta.image,
|
||||
});
|
||||
history.push(referal);
|
||||
};
|
||||
console.log(meta.id)
|
||||
Nui.send('photo:deletePhoto', {
|
||||
id: meta.id
|
||||
})
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
const handleSharePhoto = useCallback(() => {
|
||||
setShareOpen(meta);
|
||||
}, [meta]);
|
||||
|
||||
if (!meta) return null;
|
||||
const handleSharePhoto = () => {
|
||||
setShareModal(true)
|
||||
setShareLink(meta.image)
|
||||
}
|
||||
|
||||
if(!meta) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<ShareModal referal={referal} meta={shareOpen} onClose={() => setShareOpen(null)} />
|
||||
<Paper className={classes.modal}>
|
||||
<div className={shareOpen ? classes.backgroundModal : null} />
|
||||
<Button onClick={_handleClose}>
|
||||
<ArrowBackIcon />
|
||||
<Paper className={modal ? classes.modal : classes.modalHide}>
|
||||
<ShareModal key={meta.id} {...meta}/>
|
||||
<div className={shareModal ? classes.backgroundModal : undefined} />
|
||||
<Button onClick={_handleClose}><ArrowBackIcon /></Button>
|
||||
<div className={classes.image} style={{ backgroundImage: `url(${meta.image})`}} />
|
||||
<div className={classes.actionDiv}>
|
||||
<Button onClick={handleDeletePhoto}>
|
||||
<DeleteIcon fontSize="large" />
|
||||
</Button>
|
||||
<div className={classes.image} style={{ backgroundImage: `url(${meta.image})` }} />
|
||||
<div className={classes.actionDiv}>
|
||||
<Button onClick={handleDeletePhoto}>
|
||||
<DeleteIcon fontSize="large" />
|
||||
</Button>
|
||||
<Button onClick={handleSharePhoto}>
|
||||
<ShareIcon fontSize="large" />
|
||||
</Button>
|
||||
</div>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
};
|
||||
<Button onClick={handleSharePhoto}>
|
||||
<ShareIcon fontSize="large" />
|
||||
</Button>
|
||||
</div>
|
||||
</Paper>
|
||||
)
|
||||
}
|
||||
@@ -1,42 +1,47 @@
|
||||
import React from 'react';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import { useShareLink } from '../../hooks/useShareLink';
|
||||
import { useShareModal } from '../../hooks/useShareModal';
|
||||
import { Button } from '@material-ui/core';
|
||||
import MessageIcon from '@material-ui/icons/Message';
|
||||
import { setClipboard } from '../../../../os/phone/hooks/useClipboard';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
|
||||
import useStyles from './modal.styles';
|
||||
import { ICameraPhoto } from '../../hooks/usePhotos';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
interface IShareModalProps {
|
||||
meta: ICameraPhoto;
|
||||
referal: string;
|
||||
onClose(): void;
|
||||
}
|
||||
|
||||
export const ShareModal = ({ meta, onClose, referal }: IShareModalProps) => {
|
||||
export const ShareModal = (meta) => {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
const { shareModal, setShareModal } = useShareModal();
|
||||
const { setShareLink } = useShareLink();
|
||||
|
||||
const _handleClose = () => {
|
||||
setShareModal(false);
|
||||
setShareLink(null);
|
||||
};
|
||||
|
||||
const handleCopyImage = () => {
|
||||
setClipboard(meta.image);
|
||||
history.push(referal);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal visible={!!meta} handleClose={onClose}>
|
||||
<Modal visible={shareModal} handleClose={_handleClose}>
|
||||
<div className={classes.shareModal}>
|
||||
<Button
|
||||
style={{ position: 'absolute', right: 0, width: '10%' }}
|
||||
onClick={_handleClose}
|
||||
>
|
||||
<CloseIcon />
|
||||
</Button>
|
||||
<div className={classes.innerShareModal}>
|
||||
<>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||
Where do you want to share the photo?
|
||||
</h4>
|
||||
<Button>{<MessageIcon />} Message</Button>
|
||||
<h4>Or just copy the image here:</h4>
|
||||
<Button onClick={handleCopyImage} variant="contained">
|
||||
Copy image
|
||||
</Button>
|
||||
</>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||
Where do you want to share the photo?
|
||||
</h4>
|
||||
<Button>{<MessageIcon />} Message</Button>
|
||||
<h4>Or just copy the image here:</h4>
|
||||
<Button onClick={handleCopyImage} variant='contained'>
|
||||
Copy image
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -2,9 +2,9 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundModal: {
|
||||
background: 'black',
|
||||
opacity: '0.6',
|
||||
position: 'absolute',
|
||||
background: "black",
|
||||
opacity: "0.6",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
width: '100%',
|
||||
},
|
||||
modalHide: {
|
||||
display: 'none',
|
||||
display: 'none'
|
||||
},
|
||||
image: {
|
||||
width: 'auto',
|
||||
@@ -27,22 +27,22 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundPosition: 'center',
|
||||
backgroundSize: 'cover',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
marginTop: '4em',
|
||||
marginTop: '4em'
|
||||
},
|
||||
actionDiv: {
|
||||
marginTop: 15,
|
||||
display: 'flex',
|
||||
justifyContent: 'space-evenly',
|
||||
justifyContent: 'space-evenly'
|
||||
},
|
||||
|
||||
// share modal
|
||||
shareModal: {
|
||||
marginBottom: 50,
|
||||
marginBottom: 50
|
||||
},
|
||||
innerShareModal: {
|
||||
marginTop: 40,
|
||||
textAlign: 'center',
|
||||
},
|
||||
}));
|
||||
textAlign: 'center'
|
||||
}
|
||||
}))
|
||||
|
||||
export default useStyles;
|
||||
export default useStyles;
|
||||
@@ -3,6 +3,22 @@ import { atom } from 'recoil';
|
||||
export const photoState = {
|
||||
photos: atom({
|
||||
key: 'galleryPhotos',
|
||||
default: null,
|
||||
default: null
|
||||
}),
|
||||
};
|
||||
modal: atom({
|
||||
key: 'photoModal',
|
||||
default: false
|
||||
}),
|
||||
photoMeta: atom({
|
||||
key: 'photoMeta',
|
||||
default: null
|
||||
}),
|
||||
shareModal: atom({
|
||||
key: 'phoneShareModal',
|
||||
default: false
|
||||
}),
|
||||
shareLink: atom({
|
||||
key: 'photoShareLink',
|
||||
default: null
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export const usePhotoMeta = () => {
|
||||
const [meta, setMeta] = useRecoilState(photoState.photoMeta);
|
||||
return { meta, setMeta};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export const usePhotoModal = () => {
|
||||
const [modal, setModal] = useRecoilState(photoState.modal);
|
||||
return { modal, setModal}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { photoState } from './state';
|
||||
import { usePhotos } from './usePhotos';
|
||||
|
||||
export const usePhotoService = () => {
|
||||
const setPhotos = useSetRecoilState(photoState.photos);
|
||||
useNuiEvent('CAMERA', 'setPhotos', setPhotos);
|
||||
};
|
||||
return usePhotos();
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export interface ICameraPhoto {
|
||||
id: string;
|
||||
image: string;
|
||||
interface IPhotos {
|
||||
image: string[];
|
||||
|
||||
map?: any;
|
||||
}
|
||||
|
||||
export const usePhotos = (): ICameraPhoto[] | null => {
|
||||
return useRecoilValue<ICameraPhoto[] | null>(photoState.photos);
|
||||
};
|
||||
|
||||
export const usePhotos = (): IPhotos | null => {
|
||||
const photos = useRecoilValue<IPhotos | null>(photoState.photos);
|
||||
return photos;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export const useShareLink = () => {
|
||||
const [ shareLink, setShareLink ] = useRecoilState(photoState.shareLink);
|
||||
return { shareLink, setShareLink }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export const useShareModal = () => {
|
||||
const [ shareModal, setShareModal ] = useRecoilState(photoState.shareModal);
|
||||
return { shareModal, setShareModal }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#contact-app .Mui-focused::after {
|
||||
border-bottom: #2196f3 solid 4px;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import React, { useState } from 'react';
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
import { Button, TextField } from '@material-ui/core';
|
||||
import Nui from '../../../os/nui-events/utils/Nui';
|
||||
import List from '@material-ui/core/List';
|
||||
import ListItem from '@material-ui/core/ListItem';
|
||||
import Modal from '../../../ui/components/Modal';
|
||||
import { useModal } from '../hooks/useModal';
|
||||
import ClearIcon from '@material-ui/icons/Clear';
|
||||
import PersonIcon from '@material-ui/icons/Person';
|
||||
import PhoneIcon from '@material-ui/icons/Phone';
|
||||
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
|
||||
import useStyles from './styles.contactmodal';
|
||||
|
||||
export const AddContactModal = () => {
|
||||
const [name, setName] = useState('');
|
||||
const [number, setNumber] = useState('');
|
||||
const [avatar, setAvatar] = useState('');
|
||||
const classes = useStyles();
|
||||
|
||||
const { showModal, setShowModal } = useModal();
|
||||
|
||||
const addContact = () => {
|
||||
if (name === '' || number === '') {
|
||||
console.log('You need to pass in values');
|
||||
} else {
|
||||
Nui.send('contacts:add', {
|
||||
name,
|
||||
number,
|
||||
avatar,
|
||||
});
|
||||
console.log(name, number, avatar);
|
||||
}
|
||||
};
|
||||
|
||||
const _handleClose = () => {
|
||||
setShowModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal visible={showModal} handleClose={_handleClose}>
|
||||
<Button onClick={_handleClose} className={classes.clearButton}>
|
||||
<ClearIcon />
|
||||
</Button>
|
||||
<List style={{ marginTop: 30 }}>
|
||||
<ListItem>
|
||||
<PersonIcon className={classes.icons} />
|
||||
<TextField
|
||||
value={name}
|
||||
inputProps={{ className: classes.textInputField }}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
fullWidth
|
||||
variant='standard'
|
||||
placeholder='Name'
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<PhoneIcon className={classes.icons} />
|
||||
<TextField
|
||||
value={number}
|
||||
inputProps={{ className: classes.textInputField }}
|
||||
onChange={(e) => setNumber(e.target.value)}
|
||||
fullWidth
|
||||
placeholder='Number'
|
||||
variant='standard'
|
||||
type='text'
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<AccountCircleIcon className={classes.icons} />
|
||||
<TextField
|
||||
value={avatar}
|
||||
inputProps={{ className: classes.textInputField }}
|
||||
onChange={(e) => setAvatar(e.target.value)}
|
||||
fullWidth
|
||||
placeholder='Avatar URL'
|
||||
variant='standard'
|
||||
type='text'
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Button className={classes.addBtn} onClick={addContact}>
|
||||
Add Contact
|
||||
</Button>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import ContactsIcon from '@material-ui/icons/Contacts';
|
||||
import useStyles from './styles.contacts';
|
||||
|
||||
export const ContactTitle = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper className={classes.root} square variant='outlined' elevation={24}>
|
||||
<ContactsIcon className={classes.icon} />
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
@@ -1,57 +1,49 @@
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { ContactList } from './List/ContactList';
|
||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
import { Route } from 'react-router-dom';
|
||||
import { AddContactModal } from './ContactModal';
|
||||
import { useModal } from '../hooks/useModal';
|
||||
import { SearchContacts } from './List/SearchContacts';
|
||||
import PersonAddIcon from '@material-ui/icons/PersonAdd';
|
||||
import Fab from '@material-ui/core/Fab';
|
||||
import { InfoModal } from './modal/InfoModal';
|
||||
import { useContactDetail } from '../hooks/useContactDetail';
|
||||
import { ContactAlert } from './alert/ContactAlert';
|
||||
|
||||
import ContactsInfoPage from './views/ContactInfo';
|
||||
import { ContactPage } from './views/ContactsPage';
|
||||
import { ContactsThemeProvider } from '../providers/ContactsThemeProvider';
|
||||
import useStyles from './styles.contacts';
|
||||
|
||||
export const ContactsApp = () => {
|
||||
const classes = useStyles();
|
||||
const { showModal, setShowModal } = useModal();
|
||||
const contacts = useApp('CONTACTS');
|
||||
const { contactDetail } = useContactDetail();
|
||||
|
||||
const openModal = () => {
|
||||
setShowModal(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<ContactsThemeProvider>
|
||||
<AppWrapper id="contact-app">
|
||||
<AppTitle app={contacts} />
|
||||
<AppContent>
|
||||
<Route path="/contacts/" exact component={ContactPage} />
|
||||
<Route path="/contacts/:id" exact component={ContactsInfoPage} />
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
</ContactsThemeProvider>
|
||||
<AppWrapper id='contact-app'>
|
||||
<AppTitle app={contacts} />
|
||||
<SearchContacts />
|
||||
<AddContactModal />
|
||||
<InfoModal key={contactDetail?.id} />
|
||||
<div className={showModal ? classes.backgroundModal : undefined} />
|
||||
<AppContent>
|
||||
<ContactList />
|
||||
<Fab
|
||||
onClick={openModal}
|
||||
style={{ backgroundColor: '#2196f3', color: '#fff' }}
|
||||
className={classes.absolute}
|
||||
>
|
||||
<PersonAddIcon />
|
||||
</Fab>
|
||||
<ContactAlert />
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
app: 'CONTACTS',
|
||||
method: 'setContacts',
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
display: 'Ruqen',
|
||||
number: '555-15196',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
display: 'Taso',
|
||||
number: '215-8139',
|
||||
avatar: 'http://i.tasoagc.dev/i9Ig',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
display: 'Chip',
|
||||
number: '111-1111',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
display: 'Kidz',
|
||||
number: '444-4444',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@@ -1,80 +1,110 @@
|
||||
import React from 'react';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
import { Button, ListItemAvatar, Avatar as MuiAvatar, List, ListItem } from '@material-ui/core';
|
||||
import {
|
||||
Button,
|
||||
ListItemAvatar,
|
||||
Avatar as MuiAvatar,
|
||||
List,
|
||||
ListItem,
|
||||
TextField,
|
||||
Collapse,
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faPen } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
|
||||
import PhoneIcon from '@material-ui/icons/Phone';
|
||||
import ChatIcon from '@material-ui/icons/Chat';
|
||||
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
||||
import { useContacts } from '../../hooks/useContacts';
|
||||
import { useContactModal } from '../../hooks/useContactModal';
|
||||
import { useContactDetail } from '../../hooks/useContactDetail';
|
||||
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { SearchContacts } from './SearchContacts';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import LogDebugEvent from '../../../../os/debug/LogDebugEvents';
|
||||
import { CallEvents } from '../../../../../../typings/call';
|
||||
|
||||
import '../Contact.css';
|
||||
import { ContactAlert } from '../alert/ContactAlert';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
updateButton: {
|
||||
margin: 'auto',
|
||||
fontSize: 14,
|
||||
width: 150,
|
||||
background: '#2196f3',
|
||||
marginBottom: 10,
|
||||
padding: 8,
|
||||
},
|
||||
collapseItem: {
|
||||
margin: 'auto',
|
||||
width: '50%',
|
||||
},
|
||||
}));
|
||||
|
||||
export const ContactList = () => {
|
||||
const { filteredContacts } = useFilteredContacts();
|
||||
const history = useHistory();
|
||||
const { setShowContactModal } = useContactModal();
|
||||
const { contactDetail, setContactDetail } = useContactDetail();
|
||||
|
||||
const { contacts } = useContacts();
|
||||
const contacts = useContacts();
|
||||
|
||||
const openContactInfo = (contactId: number) => {
|
||||
history.push(`/contacts/${contactId}`);
|
||||
const openContactInfo = (contact) => {
|
||||
setShowContactModal(true);
|
||||
setContactDetail(contact);
|
||||
console.log('CONTACT', contactDetail);
|
||||
};
|
||||
|
||||
const startCall = (number: string) => {
|
||||
LogDebugEvent({
|
||||
action: 'Emitting `Start Call` to Scripts',
|
||||
level: 2,
|
||||
data: true,
|
||||
});
|
||||
Nui.send(CallEvents.INITIALIZE_CALL, {
|
||||
const startCall = (number) => {
|
||||
console.log(number);
|
||||
Nui.send('phone:startCall', {
|
||||
number,
|
||||
});
|
||||
};
|
||||
|
||||
const handleMessage = (phoneNumber: string) => {
|
||||
LogDebugEvent({
|
||||
action: 'Routing to Message',
|
||||
level: 1,
|
||||
data: { phoneNumber },
|
||||
});
|
||||
history.push(`/messages/new/${phoneNumber}`);
|
||||
};
|
||||
|
||||
const filteredRegEx = new RegExp(filteredContacts, 'gi');
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchContacts />
|
||||
<List>
|
||||
{contacts
|
||||
.filter(
|
||||
(contact) =>
|
||||
contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx),
|
||||
)
|
||||
.map((contact) => (
|
||||
<List>
|
||||
{contacts.contacts
|
||||
.filter(
|
||||
(contact) =>
|
||||
contact.display.includes(filteredContacts.toLowerCase()) ||
|
||||
contact.number.includes(filteredContacts.toLowerCase())
|
||||
)
|
||||
.map((contact) => (
|
||||
<>
|
||||
<ListItem key={contact.id} divider>
|
||||
<ListItemAvatar>
|
||||
{contact.avatar ? (
|
||||
<MuiAvatar src={contact.avatar} />
|
||||
) : (
|
||||
<MuiAvatar>{contact.display.slice(0, 1).toUpperCase()}</MuiAvatar>
|
||||
<MuiAvatar>
|
||||
{contact.display.slice(0, 1).toUpperCase()}
|
||||
</MuiAvatar>
|
||||
)}
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary={contact.display} secondary={contact.number} />
|
||||
<ListItemText
|
||||
primary={contact.display}
|
||||
secondary={contact.number}
|
||||
/>
|
||||
<Button onClick={() => startCall(contact.number)}>
|
||||
<PhoneIcon />
|
||||
</Button>
|
||||
<Button onClick={() => handleMessage(contact.number)}>
|
||||
<Button
|
||||
onClick={() =>
|
||||
console.log('Message: ' + contact.display, contact.number)
|
||||
}
|
||||
>
|
||||
<ChatIcon />
|
||||
</Button>
|
||||
<Button style={{ margin: -15 }} onClick={() => openContactInfo(contact.id)}>
|
||||
<Button
|
||||
style={{ margin: -15 }}
|
||||
onClick={() => openContactInfo(contact)}
|
||||
>
|
||||
<MoreVertIcon />
|
||||
</Button>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
</>
|
||||
</>
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
@@ -1,22 +1,94 @@
|
||||
import React from 'react';
|
||||
import { Box } from '@material-ui/core';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { InputBase } from '@material-ui/core';
|
||||
import SearchIcon from '@material-ui/icons/Search';
|
||||
import {
|
||||
createStyles,
|
||||
fade,
|
||||
Theme,
|
||||
makeStyles,
|
||||
} from '@material-ui/core/styles';
|
||||
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
import { SearchField } from '../../../../ui/components/SearchField';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
bg: {
|
||||
backgroundColor: '#232323',
|
||||
display: 'flex',
|
||||
height: 60,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: 20,
|
||||
},
|
||||
inputRoot: {
|
||||
color: '#fff',
|
||||
fontSize: 18,
|
||||
},
|
||||
inputInput: {
|
||||
padding: theme.spacing(1, 4, 1, 4),
|
||||
transition: theme.transitions.create('width'),
|
||||
width: '100%',
|
||||
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: '13ch',
|
||||
'&:focus': {
|
||||
width: '20ch',
|
||||
},
|
||||
},
|
||||
},
|
||||
search: {
|
||||
position: 'relative',
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
backgroundColor: fade(theme.palette.common.white, 0.15),
|
||||
'&:hover': {
|
||||
backgroundColor: fade(theme.palette.common.white, 0.25),
|
||||
},
|
||||
marginLeft: 0,
|
||||
width: '100%',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
marginLeft: theme.spacing(1),
|
||||
width: 'auto',
|
||||
},
|
||||
},
|
||||
searchIcon: {
|
||||
padding: theme.spacing(0, 0.5),
|
||||
height: '100%',
|
||||
position: 'absolute',
|
||||
pointerEvents: 'none',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
export const SearchContacts = () => {
|
||||
const { setFilteredContacts, filteredContacts } = useFilteredContacts();
|
||||
const { t } = useTranslation();
|
||||
const { setFilteredContacts } = useFilteredContacts();
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
const handleChange = (e) => {
|
||||
setFilteredContacts(e.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<SearchField
|
||||
onChange={(e) => setFilteredContacts(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS')}
|
||||
value={filteredContacts}
|
||||
/>
|
||||
</Box>
|
||||
<div className={classes.bg}>
|
||||
<div className={classes.search}>
|
||||
<div className={classes.searchIcon}>
|
||||
<SearchIcon style={{ color: '#fff' }} />
|
||||
</div>
|
||||
<InputBase
|
||||
onChange={handleChange}
|
||||
placeholder='Search contacts...'
|
||||
classes={{
|
||||
root: classes.inputRoot,
|
||||
input: classes.inputInput,
|
||||
}}
|
||||
inputProps={{ 'aria-label': 'search' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Snackbar } from '@material-ui/core';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Alert } from '../../../../ui/components/Alert';
|
||||
import { useContactAlert } from '../../hooks/useAlert';
|
||||
import { AlertCategory } from '../../../../common/typings/contact';
|
||||
|
||||
// Used as a prefix for referencing the locales
|
||||
// Needed to make code cleaner
|
||||
const LOCALE_PREFIX = 'APPS_';
|
||||
|
||||
export const ContactAlert = () => {
|
||||
const { t } = useTranslation();
|
||||
const { alert, setAlert } = useContactAlert();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [message, setMessage] = useState(null);
|
||||
const [severity, setSeverity] = useState('');
|
||||
|
||||
const _handleClose = () => {
|
||||
setOpen(false);
|
||||
setAlert(null);
|
||||
};
|
||||
|
||||
function setMessageAlert(type: AlertCategory, severity: 'success' | 'error') {
|
||||
setMessage(t(LOCALE_PREFIX + type));
|
||||
setSeverity(severity);
|
||||
setOpen(true);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
switch (alert) {
|
||||
case 'CONTACT_ADD_FAILED':
|
||||
setMessageAlert(alert, 'error');
|
||||
break;
|
||||
case 'CONTACT_ADD_SUCCESS':
|
||||
setMessageAlert(alert, 'success');
|
||||
break;
|
||||
case 'CONTACT_DELETE_FAILED':
|
||||
setMessageAlert(alert, 'error');
|
||||
break;
|
||||
case 'CONTACT_DELETE_SUCCESS':
|
||||
setMessageAlert(alert, 'success');
|
||||
break;
|
||||
case 'CONTACT_UPDATE_FAILED':
|
||||
setMessageAlert(alert, 'error');
|
||||
break;
|
||||
case 'CONTACT_UPDATE_SUCCESS':
|
||||
setMessageAlert(alert, 'success');
|
||||
}
|
||||
}, [alert]);
|
||||
|
||||
return (
|
||||
<Snackbar
|
||||
style={{ width: '80%', position: 'absolute', bottom: '10%' }}
|
||||
autoHideDuration={6000}
|
||||
open={open}
|
||||
onClose={_handleClose}
|
||||
>
|
||||
<Alert severity={severity} variant='filled'>
|
||||
{message}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Paper,
|
||||
Slide,
|
||||
Button,
|
||||
TextField,
|
||||
Avatar as MuiAvatar,
|
||||
} from '@material-ui/core';
|
||||
import useStyles from './modal.styles';
|
||||
import { useContactModal } from '../../hooks/useContactModal';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useContactDetail } from '../../hooks/useContactDetail';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
export const InfoModal = () => {
|
||||
const classes = useStyles();
|
||||
const { showContactModal, setShowContactModal } = useContactModal();
|
||||
const { t } = useTranslation();
|
||||
const { contactDetail, setContactDetail } = useContactDetail();
|
||||
|
||||
const [display, setDisplay] = useState(
|
||||
contactDetail ? contactDetail.display : ''
|
||||
);
|
||||
console.log(contactDetail);
|
||||
const [number, setNumber] = useState(
|
||||
contactDetail ? contactDetail.number : ''
|
||||
);
|
||||
const [avatar, setAvatar] = useState(
|
||||
contactDetail ? contactDetail.avatar : ''
|
||||
);
|
||||
|
||||
const closeModal = () => {
|
||||
setShowContactModal(false);
|
||||
setContactDetail(null);
|
||||
};
|
||||
|
||||
const updateContact = () => {
|
||||
Nui.send('phone:updateContact', {
|
||||
id: contactDetail.id,
|
||||
display,
|
||||
number,
|
||||
avatar,
|
||||
});
|
||||
setContactDetail(null);
|
||||
setShowContactModal(false);
|
||||
};
|
||||
|
||||
const deleteContact = () => {
|
||||
Nui.send('phone:deleteContact', {
|
||||
id: contactDetail.id,
|
||||
});
|
||||
setContactDetail(null);
|
||||
setShowContactModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Slide direction='up' in={showContactModal}>
|
||||
<Paper
|
||||
className={showContactModal ? classes.modalRoot : classes.modalHide}
|
||||
square
|
||||
>
|
||||
<Button style={{ margin: 10 }} onClick={closeModal}>
|
||||
<ArrowBackIcon fontSize='large' />
|
||||
</Button>
|
||||
<div className={classes.listContainer}>
|
||||
<MuiAvatar className={classes.avatar} src={avatar} />
|
||||
<TextField
|
||||
className={classes.input}
|
||||
value={display}
|
||||
onChange={(e) => setDisplay(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_FORM_NAME')}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
value={number}
|
||||
onChange={(e) => setNumber(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_FORM_NUMBER')}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder={t('APPS_CONTACT_FORM_AVATAR')}
|
||||
fullWidth
|
||||
value={avatar}
|
||||
onChange={(e) => setAvatar(e.target.value)}
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
}}
|
||||
/>
|
||||
|
||||
<div style={{ display: 'block' }}>
|
||||
<Button onClick={updateContact} className={classes.updateButton}>
|
||||
Update
|
||||
</Button>
|
||||
<Button onClick={deleteContact} className={classes.deleteButton}>
|
||||
Delete
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Paper>
|
||||
</Slide>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
modalRoot: {
|
||||
zIndex: 10,
|
||||
position: 'absolute',
|
||||
height: '100%',
|
||||
width: '100%'
|
||||
},
|
||||
modalHide: {
|
||||
display: 'none'
|
||||
},
|
||||
listContainer: {
|
||||
marginTop: 30,
|
||||
width: '75%',
|
||||
margin: '0 auto',
|
||||
textAlign: 'center',
|
||||
},
|
||||
avatar: {
|
||||
margin: 'auto',
|
||||
height: '125px',
|
||||
width: '124px',
|
||||
marginBottom: 29
|
||||
},
|
||||
input: {
|
||||
marginBottom: 20,
|
||||
margin: 'auto',
|
||||
textAlign: 'center',
|
||||
},
|
||||
inputProps: {
|
||||
fontSize: 22
|
||||
},
|
||||
updateButton: {
|
||||
background: '#2196f3',
|
||||
width: 150,
|
||||
height: 45,
|
||||
fontSize: 16,
|
||||
marginTop: 29,
|
||||
marginBottom: 29
|
||||
},
|
||||
deleteButton: {
|
||||
background: '#d32f2f',
|
||||
width: 150,
|
||||
height: 40,
|
||||
fontSize: 16
|
||||
}
|
||||
}))
|
||||
|
||||
export default useStyles;
|
||||
@@ -0,0 +1,45 @@
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
button: {
|
||||
margin: 5,
|
||||
marginTop: 20,
|
||||
},
|
||||
root: {
|
||||
position: 'fixed',
|
||||
bottom: 380,
|
||||
zIndex: 2,
|
||||
background: '#232323',
|
||||
marginLeft: '-4em',
|
||||
height: '20%',
|
||||
},
|
||||
clearButton: {
|
||||
width: '10%',
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
},
|
||||
textInputField: {
|
||||
fontSize: 20,
|
||||
borderBottomColor: 'red',
|
||||
},
|
||||
addBtn: {
|
||||
margin: 'auto',
|
||||
fontSize: 16,
|
||||
width: 150,
|
||||
background: '#2196f3',
|
||||
marginBottom: 10,
|
||||
padding: 8,
|
||||
},
|
||||
cancelBtn: {
|
||||
margin: 'auto',
|
||||
width: 150,
|
||||
background: '#232323',
|
||||
marginBottom: 20,
|
||||
padding: 8,
|
||||
},
|
||||
icons: {
|
||||
marginRight: 5,
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
||||
@@ -0,0 +1,35 @@
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
backgroundModal: {
|
||||
background: 'black',
|
||||
opacity: '0.6',
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 5,
|
||||
},
|
||||
absolute: {
|
||||
position: 'absolute',
|
||||
bottom: theme.spacing(2),
|
||||
left: theme.spacing(3),
|
||||
},
|
||||
// title
|
||||
root: {
|
||||
height: '60px',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
flexFlow: 'row nowrap',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
background: '#424242',
|
||||
},
|
||||
icon: {
|
||||
color: '#fff',
|
||||
fontSize: 30,
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
||||
@@ -1,184 +0,0 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Avatar as MuiAvatar, Box, Button, Paper, TextField } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useHistory, useParams } from 'react-router-dom';
|
||||
import { useContacts } from '../../hooks/useContacts';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
import LogDebugEvent from '../../../../os/debug/LogDebugEvents';
|
||||
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||
import { ContactEvents } from '../../../../../../typings/contact';
|
||||
|
||||
interface ContactInfoRouteParams {
|
||||
mode: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface ContactInfoRouteQuery {
|
||||
addNumber?: string;
|
||||
referal?: string;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
},
|
||||
listContainer: {
|
||||
marginTop: 30,
|
||||
width: '75%',
|
||||
margin: '0 auto',
|
||||
textAlign: 'center',
|
||||
},
|
||||
avatar: {
|
||||
margin: 'auto',
|
||||
height: '125px',
|
||||
width: '124px',
|
||||
marginBottom: 29,
|
||||
},
|
||||
input: {
|
||||
marginBottom: 20,
|
||||
margin: 'auto',
|
||||
textAlign: 'center',
|
||||
},
|
||||
inputProps: {
|
||||
fontSize: 22,
|
||||
},
|
||||
});
|
||||
|
||||
const ContactsInfoPage = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const history = useHistory();
|
||||
|
||||
const { getContact } = useContacts();
|
||||
|
||||
const { id } = useParams<ContactInfoRouteParams>();
|
||||
const { addNumber, referal } = useQueryParams<ContactInfoRouteQuery>({
|
||||
referal: '/contacts',
|
||||
});
|
||||
|
||||
const contact = getContact(parseInt(id));
|
||||
|
||||
// Set state after checking if null
|
||||
const [name, setName] = useState(contact ? contact.display : '');
|
||||
const [number, setNumber] = useState(contact ? contact.number : '');
|
||||
const [avatar, setAvatar] = useState(contact ? contact.avatar : '');
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
if (addNumber) {
|
||||
setNumber(addNumber);
|
||||
}
|
||||
}, [addNumber]);
|
||||
|
||||
const handleContactAdd = () => {
|
||||
LogDebugEvent({
|
||||
action: 'Handling Contact Add',
|
||||
data: contact,
|
||||
level: 2,
|
||||
});
|
||||
Nui.send(ContactEvents.ADD_CONTACT, {
|
||||
display: name,
|
||||
number,
|
||||
avatar,
|
||||
});
|
||||
history.replace(referal);
|
||||
};
|
||||
|
||||
const handleContactSave = () => {
|
||||
LogDebugEvent({
|
||||
action: 'Handling Contact Update',
|
||||
data: contact,
|
||||
level: 2,
|
||||
});
|
||||
Nui.send(ContactEvents.UPDATE_CONTACT, {
|
||||
id: contact.id,
|
||||
display: name,
|
||||
number,
|
||||
avatar,
|
||||
});
|
||||
history.goBack();
|
||||
};
|
||||
|
||||
const handleContactDelete = () => {
|
||||
LogDebugEvent({
|
||||
action: 'Handling Contact Delete',
|
||||
data: contact,
|
||||
level: 2,
|
||||
});
|
||||
Nui.send(ContactEvents.DELETE_CONTACT, {
|
||||
id: contact.id,
|
||||
});
|
||||
history.goBack();
|
||||
};
|
||||
|
||||
return (
|
||||
<Paper className={classes.root} square>
|
||||
<Button style={{ margin: 10 }} onClick={() => history.goBack()}>
|
||||
<ArrowBackIcon fontSize="large" />
|
||||
</Button>
|
||||
<div className={classes.listContainer}>
|
||||
<MuiAvatar className={classes.avatar} src={avatar} />
|
||||
<TextField
|
||||
autoFocus
|
||||
className={classes.input}
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
label={t('APPS_CONTACT_FORM_NAME')}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
value={number}
|
||||
onChange={(e) => setNumber(e.target.value)}
|
||||
label={t('APPS_CONTACT_FORM_NUMBER')}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
label={t('APPS_CONTACT_FORM_AVATAR')}
|
||||
fullWidth
|
||||
value={avatar}
|
||||
onChange={(e) => setAvatar(e.target.value)}
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
}}
|
||||
/>
|
||||
{/* Display if fetched contact */}
|
||||
{contact && (
|
||||
<>
|
||||
<Box py={1} display="block">
|
||||
<Button color="primary" variant="contained" onClick={handleContactSave}>
|
||||
{t('GENERIC_UPDATE')}
|
||||
</Button>
|
||||
</Box>
|
||||
<Box py={1} display="block">
|
||||
<Button variant="contained" color="secondary" onClick={handleContactDelete}>
|
||||
{t('GENERIC_DELETE')}
|
||||
</Button>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{/* Display if no fetched contact */}
|
||||
{!contact && (
|
||||
<Box display="block">
|
||||
<Button color="primary" variant="contained" onClick={handleContactAdd}>
|
||||
{t('APPS_CONTACT_MODAL_BUTTON_ADD')}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
</div>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
|
||||
export default ContactsInfoPage;
|
||||
@@ -1,37 +0,0 @@
|
||||
import React from 'react';
|
||||
import Fab from '@material-ui/core/Fab';
|
||||
import PersonAddIcon from '@material-ui/icons/PersonAdd';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
import { ContactList } from '../List/ContactList';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
absolute: {
|
||||
position: 'absolute',
|
||||
bottom: theme.spacing(2),
|
||||
right: theme.spacing(2),
|
||||
},
|
||||
icon: {
|
||||
color: '#fff',
|
||||
fontSize: 30,
|
||||
},
|
||||
}));
|
||||
|
||||
export const ContactPage = () => {
|
||||
const history = useHistory();
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContactList />
|
||||
<Fab
|
||||
color="primary"
|
||||
onClick={() => history.push('/contacts/-1')}
|
||||
className={classes.absolute}
|
||||
>
|
||||
<PersonAddIcon />
|
||||
</Fab>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
import { blue, common } from '@material-ui/core/colors';
|
||||
|
||||
export const CONTACTS_APP_PRIMARY_COLOR = blue[500];
|
||||
export const CONTACTS_APP_TEXT_COLOR = common.white;
|
||||
|
||||
const theme = {
|
||||
palette: {
|
||||
primary: {
|
||||
main: CONTACTS_APP_PRIMARY_COLOR,
|
||||
dark: blue[700],
|
||||
light: blue[300],
|
||||
contrastText: CONTACTS_APP_TEXT_COLOR,
|
||||
},
|
||||
secondary: {
|
||||
main: '#d32f2f',
|
||||
light: '#eb4242',
|
||||
dark: '#941212',
|
||||
contrastText: CONTACTS_APP_TEXT_COLOR,
|
||||
},
|
||||
success: {
|
||||
main: '#2196f3',
|
||||
contrastText: CONTACTS_APP_TEXT_COLOR,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default theme;
|
||||
@@ -21,4 +21,8 @@ export const contactsState = {
|
||||
key: 'contactDetail',
|
||||
default: null,
|
||||
}),
|
||||
contactAlert: atom({
|
||||
key: 'contactAlert',
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { IContactAlert } from '../../../common/typings/contact';
|
||||
import { contactsState } from './state';
|
||||
|
||||
export const useContactAlert = (): IContactAlert => {
|
||||
const [alert, setAlert] = useRecoilState(contactsState.contactAlert);
|
||||
return { alert, setAlert };
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { contactsState } from './state';
|
||||
|
||||
export const useContactDetail = (): any => {
|
||||
const [ contactDetail, setContactDetail ] = useRecoilState(contactsState.contactDetail);
|
||||
return { contactDetail, setContactDetail };
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { contactsState } from './state';
|
||||
|
||||
export const useContactModal = () => {
|
||||
const [ showContactModal, setShowContactModal ] = useRecoilState(contactsState.showContactsModal);
|
||||
return { showContactModal, setShowContactModal };
|
||||
}
|
||||