Author SHA1 Message Date
Taso 4a60164faf ci(cleanup): cleaned up scripts for deployment 2021-08-05 21:02:44 -04:00
Taso 381f298ad4 feat(ci): automatically bump versioning on tag push 2021-08-05 20:43:32 -04:00
Taso 8461c1acd2 tweak(phone): tweaked env handling to expose package.json version for sentry 2021-08-05 20:42:43 -04:00
Taso dce079222a ci(tagged-release): no longer tag releases with v*
makes this easier for semver tracking and consistency sake
2021-08-05 20:24:38 -04:00
Taso 13952fa318 ci(tagged-release): setup sentry deployment with node
and mis general cleanup
2021-08-05 19:45:29 -04:00
Taso 95c3aea1d9 ci(pre-release): cleaned up pre-release ci slightly 2021-08-05 19:44:38 -04:00
Taso 1583789341 fix(ci/pre-release): get and set step vars properly 2021-08-05 19:16:08 -04:00
Taso 04f9195444 ci(dependabot): replaced by depfu 2021-08-05 18:28:17 -04:00
Taso d0419b067a fix(ci/pre-release): set auto tag on release 2021-08-05 18:25:08 -04:00
Taso 858bd1cf78 Merge remote-tracking branch 'personal/ci-testing' 2021-08-05 18:18:00 -04:00
Taso a87b1afe2a fix(ci/pre-release): hopefully fix pre-release build 2021-08-05 18:16:22 -04:00
Taso aa294e749e Merge branch 'develop' 2021-08-05 17:14:37 -04:00
Christopher 2cbd3c934d fix(match): fix suspense issue 2021-08-02 12:22:42 +02:00
Christopher 98358e54eb chore(camera): remove unused log 2021-08-02 12:09:48 +02:00
Christopher 96aa7107ba feat(camera): disable camera mode 2021-08-02 11:58:25 +02:00
Christopher 5dcb654516 fix(player): force identifier to string 2021-08-02 11:16:32 +02:00
chip 1253c76aef Feat/refactor matchmaker promise format (#293) 2021-08-01 00:26:10 +02:00
Taso 7ed5f54709 fix(phone/call-modal): suspense fallback on contact lookup in call modal 2021-07-29 21:12:58 -04:00
Taso 553e04ef3c tweak(config): remove unused options from root config 2021-07-29 20:41:55 -04:00
Taso c644d177f1 fix(calls/modal): Fixed translation key for ringing text 2021-07-29 20:34:19 -04:00
Taso 5263a83d1f fix(calls): Fix incorrect data type being sent over net 2021-07-29 20:29:27 -04:00
Christopher 60b9e35ae8 fix(marketplace): should probably change the name of the loger too 2021-07-29 20:25:58 +02:00
Christopher bdc79aeff9 chore(marketplace): clean up references of 'sellout' 2021-07-29 19:37:02 +02:00
Christopher 7cf1e20e8f fix(browser): inputbase 2021-07-29 16:52:44 +02:00
Taso 71e9908f35 fix(phone/browser): fix class attr on iframe when webcomp is disabled 2021-07-28 22:52:38 -04:00
Taso 929663af0c tweak(phone/browser): include experimental iframe extension comp 2021-07-28 22:49:33 -04:00
Taso a06ef07902 feat(phone/browser): Added a browser app
This utilizes an iframe, meaning sites that are blocking cross-origin iframes will ultimately fail.

With this feature, a config option is added to the nui config allowing for users to specify a home page URL to default to.
2021-07-28 21:21:11 -04:00
Taso b433c2bda0 fix(phone/contacts): fix input length handling for numbers 2021-07-28 16:44:14 -04:00
Taso 334a79b68b chore(phone/build): fix various eslint warnings on build 2021-07-28 14:59:47 -04:00
Taso e2f03f411d chore(resources): rebuild lock file 2021-07-28 14:43:31 -04:00
Taso be4323f337 tweak(calls): Abstract initialize call action & own number handling 2021-07-28 14:41:19 -04:00
Taso af6e291368 fix(calls): fix some bugs encountered during refactor 2021-07-28 14:26:01 -04:00
Taso 10c5e97088 fix(calls): fix references to async selector DialerHistory 2021-07-28 14:26:01 -04:00
Taso 36d1e993bd refactor(calls): refactor of call architecture 2021-07-28 14:26:00 -04:00
Taso 92b687b130 ci(sentry): update sentry to use new hosted instance
this might not work but hey it kinda does
2021-07-28 14:25:47 -04:00
Taso b45ad53bc6 ci(main): ensure modules can be built on run 2021-07-27 23:12:12 -04:00
Taso d648b21d3b tweak(phone): update old NuiCallbacks with new wrapper func
Also switches old Nui.send() calls with fetchNui on focus input control
2021-07-27 23:08:40 -04:00
Taso fc939885a8 feat(config): configure an export to be called at toggle to control phone access
Can serve as a primitive form of access control that can for example call a client side inventory check
2021-07-27 23:06:13 -04:00
Taso b00bee0217 chore(client/animation-service): shut eslint up about explicit types 2021-07-27 22:40:59 -04:00
Taso 16626db5bd cleanup(photos): A general cleanup of photos
Removes legacy code no longer in use or cleans up code to use new type safe native wrappers
2021-07-27 22:39:18 -04:00
Taso 83ec915926 perf(client/controls): global -> local ref optimization 2021-07-27 17:49:47 -04:00
LedAndris 05343d0540 fix(phone/settings/icons): Fixed validation error 2021-07-27 23:08:21 +02:00
Christopher 35eb0ee698 feat(ci/tagged-releases): change sentry action 2021-07-27 17:06:52 -04:00
Oldarorn d2d13200ca locales(fr): update fr translations (#289) 2021-07-27 17:06:52 -04:00
Taso 1b8755049d fix(tests): remove accidental added test file 2021-07-27 17:06:52 -04:00
Taso dd99f7e241 fix(phone/contacts): provide user feedback on max length data 2021-07-27 17:06:52 -04:00
Taso 02f0abd761 feat(sentry): add wip sentry integration on server side 2021-07-27 17:06:52 -04:00
Taso 4b724dfa73 fix(phone/marketplace): fix state dispatch when selector is loading
Should fix edge cases where broadcast events are received and processed before the original fetch promise resolves
2021-07-27 17:06:52 -04:00
Taso 44599c882d ci(sentry): update sentry to use new hosted instance
this might not work but hey it kinda does
2021-07-27 17:06:49 -04:00
Bombay eaae3c7211 feat(locales/es): Added missing translations (#286) 2021-07-27 17:04:29 -04:00
Taso 3b7326dac8 feat(phone/error-handling): add top level error boundary for reload 2021-07-27 17:04:29 -04:00
Taso 908a393451 ci(releases): auto release CI 2021-07-27 17:04:29 -04:00
Christopher 68d2e66d16 chore(phone): minor changes 2021-07-27 17:04:29 -04:00
Christopher 4e8c57492b feat(camera): refactor to new promise event format 2021-07-27 17:04:28 -04:00
Taso 1566bb0fdb fix(phone/getLocationFromUrl): fix type mismatch 2021-07-27 17:04:28 -04:00
Taso 9d7ddbca6f ci(releases): fix file name for releases? 2021-07-27 17:04:28 -04:00
Taso c073965dff ci(sentry): setup sentry with source maps on release 2021-07-27 17:04:28 -04:00
Taso 4dd075a537 ci(iswtg): this is the last time im doing this GH actions 2021-07-27 17:04:28 -04:00
Taso 8498f91a1f build(env): set process.env.CI to false
don't really want to deal with the errors being thrown by CI so it happens
2021-07-27 17:04:28 -04:00
Taso 2e714ccb0f ci(releases): auto release CI 2021-07-27 17:04:28 -04:00
dependabot[bot] f474bd0148 chore(deps-dev): bump typescript from 4.3.2 to 4.3.5 (#277) 2021-07-24 01:34:51 +00:00
Taso fcae80b785 chore(deps): bumped deps and cleaned package.json 2021-07-23 21:25:50 -04:00
dependabot[bot] 80da6a0af1 chore(deps): bump i18next from 19.8.2 to 20.3.4 (#291) 2021-07-24 00:56:34 +00:00
dependabot[bot] 33c58e9931 chore(deps): bump @discordjs/collection from 0.1.6 to 0.2.0 (#275) 2021-07-24 00:53:42 +00:00
Taso 14f44a63d1 chore(dependabot): we love you man but chill 2021-07-23 20:48:16 -04:00
Noodles 4ce98e29d3 chore(misc): migrate to "new" file hosting fileglass from iodine
If I have to do this again, I am replacing all these links with imgur ones.
2021-07-22 23:00:00 -04:00
dependabot[bot] 0a2ba225cd chore(deps-dev): bump cross-env from 7.0.2 to 7.0.3 in /phone (#279) 2021-07-20 19:48:16 +00:00
dependabot[bot] ad57768745 chore(deps-dev): bump @types/react-router-dom from 5.1.7 to 5.1.8 (#276) 2021-07-20 19:47:59 +00:00
dependabot[bot] 5b017b6892 chore(deps-dev): bump @babel/preset-typescript in /resources (#273) 2021-07-20 19:47:43 +00:00
Christopher Gjelten 029e221a98 Update README.md 2021-07-16 04:50:17 +02:00
dependabot[bot] dc1677675b chore(deps): bump core-js from 3.10.1 to 3.15.2 in /phone (#268) 2021-07-08 04:13:56 +00:00
dependabot[bot] b932a0924f chore(deps-dev): bump @babel/core from 7.14.3 to 7.14.6 in /resources (#262) 2021-07-07 16:11:21 +00:00
dependabot[bot] a562ea776a chore(deps-dev): bump prettier from 2.2.1 to 2.3.2 (#266) 2021-07-07 04:43:29 +00:00
dependabot[bot] 1b9ac61d1d chore(deps-dev): bump @types/qs from 6.9.5 to 6.9.6 (#263) 2021-07-07 04:42:52 +00:00
dependabot[bot] 69e5cdf326 chore(deps): bump parse-url from 5.0.2 to 5.0.7 in /phone
Bumps [parse-url](https://github.com/IonicaBizau/parse-url) from 5.0.2 to 5.0.7.
- [Release notes](https://github.com/IonicaBizau/parse-url/releases)
- [Commits](https://github.com/IonicaBizau/parse-url/commits)

---
updated-dependencies:
- dependency-name: parse-url
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-07-07 00:42:08 -04:00
dependabot[bot] d2e223ca39 chore(deps-dev): bump @babel/preset-env from 7.14.4 to 7.14.7
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.14.4 to 7.14.7.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.7/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-07-07 00:40:59 -04:00
Taso f9956a15a8 fix(scripts/client): fix wrong response format struct on promise reject 2021-07-06 23:58:30 -04:00
Taso 833d2f282b chore(deps): add pe-utils dep to game scripts & tweak root scripts 2021-07-06 23:58:02 -04:00
Taso e288e5b50e ci(dependabot): add dependabot coverage and setup 2021-07-06 23:56:48 -04:00
Dillon Skaggs 104fda2c11 feat(global): major fixes...i dont even know that to call this commit so ill just say its global. Who even cares 2021-07-06 23:10:47 +02:00
dependabot[bot] f6395e4b8e chore(deps): bump lodash from 4.17.20 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-07-06 17:05:46 -04:00
Dillon Skaggs 398bfa2092 feat(): add animation and call service & controllers (#259)
* feat(): add animation and call service & controllers

- run animations on interval so we don't lose animations when walking through doors
- move cl_call.ts to a class

* fix(animation/service): make everything private except for open/closePhone and start/endPhoneCall
2021-07-06 23:02:55 +02:00
Christopher 4ef89f679f fix(resources/server): changed credentials return type 2021-06-25 21:15:45 +02:00
Christopher eb5b907091 fix(dialer/ui): fix type 2021-06-25 21:14:18 +02:00
Christopher b1b412b81e fix(resources/server): import bank stuff 2021-06-18 22:09:05 +02:00
Christopher ee8a8b62cc refactor(resources/bank): move bank stuff to controller
someone else can refactor this shit
2021-06-18 22:07:21 +02:00
Christopher b033eae51e feat(resources/server): move some functions to 'misc' 2021-06-18 22:05:06 +02:00
Christopher 4029e8c7a1 feat(resources/server): remove sv_match.ts 2021-06-12 14:06:20 +02:00
Christopher b173f0ae48 perf(resources/server): order tweets by id 2021-06-12 14:04:29 +02:00
Taso 9404a6dd26 chore(marketplace): Misc cleanups 2021-06-10 17:52:14 -04:00
Jan Lecoutere 865a8e44de chore(messages/labels): removed unnecessary npwd_messages_labels column (#253) 2021-06-09 20:21:20 +02:00
Dylan Mld 94633e53a6 feat(resources): added support for identifier prefix for older esx versions. (#244) 2021-06-09 19:08:26 +02:00
Christopher 6a3bef1e34 feat(resources/server): refactor matchmaker 2021-06-09 18:51:10 +02:00
Taso 44a9595463 refactor(notes): Refactor to new promise event format 2021-06-08 23:10:16 -04:00
Taso bb81ab6fe2 dev(webpack): Tweak source map in dev mode 2021-06-08 23:09:23 -04:00
Taso e76e6c5296 feat(phone/icon-sets): Add icon sets configurable in settings 2021-06-08 23:05:13 -04:00
Taso 2c9f260417 fix(phone/apps): Fix apps referencing 'SELLOUT' instead of marketplace 2021-06-08 16:51:35 -04:00
Taso c59137d598 Merge branch 'refactor/marketplace-state' 2021-06-08 16:46:53 -04:00
Taso 28fd09ce53 tweak(phone/contacts): Tweak contact actions to remove unneeded dep 2021-06-08 16:45:57 -04:00
Taso 5493a3de76 tweak(server/onNetPromise): Enhance logging 2021-06-08 16:45:57 -04:00
Taso f0acadbf98 types(contacts): Cleanup unused types 2021-06-08 16:45:57 -04:00
Taso 52ac061a3c tweak(contacts): Misc changes to contact handling 2021-06-08 16:45:57 -04:00
Taso ecb71cc359 refactor(contacts): Refactor contacts to efficient data fetching 2021-06-08 16:45:55 -04:00
Taso 5e225ca736 tweak(marketplace): Tweak marketplace to match current fetching std 2021-06-08 16:35:41 -04:00
Christopher 10639260e0 fix(phone): move FABs outside of AppContent 2021-06-08 15:47:19 -04:00
Taso 3df2f88759 refactor(server/marketplace): Refactor to use promise events 2021-06-08 15:46:57 -04:00
Taso 4afa9c691b refactor(phone/marketplace): Refactor state management and fetching 2021-06-08 15:46:39 -04:00
Taso 2d1e192892 tweak(server/onNetPromise): Enhance logging 2021-06-08 15:45:47 -04:00
Taso 51d8aa6322 types(contacts): Cleanup unused types 2021-06-08 15:36:56 -04:00
Taso be8e9bfa39 tweak(contacts): Misc changes to contact handling 2021-06-08 15:35:12 -04:00
Taso d036243d64 refactor(contacts): Refactor contacts to efficient data fetching 2021-06-08 14:58:05 -04:00
Christopher 1940833f56 fix(phone): move FABs outside of AppContent 2021-06-08 20:45:12 +02:00
Taso 54d456cc8a fix(resources): Silence the TS compiler 2021-06-08 12:48:48 -04:00
Taso 42b2970428 tweak(resources/server): Finally remove @ts-ignore as my PR was merged 2021-06-08 12:38:34 -04:00
Taso f1012958e2 chore(resources): General Linting 2021-06-08 12:36:10 -04:00
Taso 457926263d chore(resources/deps): Upgrade deps & configure eslint for TS 2021-06-08 12:35:39 -04:00
Taso dcb7556edc tweak(resources/promise-events): Tweak promise event resp and req types 2021-06-08 12:06:52 -04:00
Taso f54dc974a2 fix(phone/apps): Apps will no longer call not existent endpoint 2021-06-08 11:21:49 -04:00
Taso 908e467011 chore(deps/phone): Bump ts and recoil 2021-06-08 10:43:08 -04:00
Christopher 478c5ffc63 fix(calls): handle invalid numbers 2021-06-05 19:19:30 +02:00
Christopher 44a0d941b9 fix(resources/calls): fix typo 2021-06-05 17:58:41 +02:00
Christopher 3446de488e fix(resources/twitter): constructor log 2021-06-05 17:58:10 +02:00
Christopher be70534108 Merge branch 'master' of https://github.com/project-error/new-phone-who-dis 2021-06-05 00:46:45 +02:00
Christopher 0e9f8bc574 feat(resources/twitter): refactor twitter
Currently just commented out the sv_twitter file. Test that it works, before removing the old file.
2021-06-05 00:46:35 +02:00
Dillon Skaggs aa185224e7 Fix useEffect infinite re-render (#245) 2021-06-05 00:12:33 +02:00
Christopher 871b9e0f1d Merge branch 'master' of https://github.com/project-error/new-phone-who-dis 2021-06-04 23:12:27 +02:00
Taso b257f5bc73 tweak(server/onNetPromise): Tweak to be less opinionated and simpler 2021-06-04 11:55:14 -04:00
Taso fed042aea7 tweak(client/utils): Add and tweak various fetch utils for refactor 2021-06-04 10:47:25 -04:00
Christopher 99fa476124 Merge branch 'master' of https://github.com/project-error/new-phone-who-dis 2021-06-04 08:18:22 +02:00
GoatGeek ebe8c67369 feat: added lua linting github action (#252) 2021-06-03 12:16:11 -04:00
Christopher c48b7333e2 Merge branch 'modal' of https://github.com/AvarianKnight/new-phone-who-dis 2021-06-02 23:20:05 +02:00
dependabot[bot] 4f380a56e1 chore(deps): bump browserslist from 4.16.3 to 4.16.6 in /resources
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.3 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.16.3...4.16.6)

Signed-off-by: dependabot[bot] <[email protected]>
2021-05-27 00:25:06 -04:00
Jan Lecoutere 870aeda3c3 Disable walking when an inputfield is focused (#234)
* feat(phone) Disable walking when an input is focused

* refactor(phone) renamed var & replaced copy paste code

Instead of copying the code it now uses a custom hook

* refactor(phone/input): removed useMemo from hook

* style(phone/input): changed indentation to spaces & added de-structured import
2021-05-24 12:22:00 -04:00
Avarian Knight f10369a4e9 remove(components/tweet): don't use escape at all
- readds useKeyboardService module
2021-05-23 23:04:20 -05:00
Avarian Knight d95062d771 fix(modal): fix infinite rerender
- fix useEffect for twitter
- removes handling escape in modal
- don't limit contacts loading
- catch error on unloading
2021-05-23 23:03:56 -05:00
Christopher Gjelten 0e1d7f40b5 Update PhoneProviders.tsx 2021-05-24 02:26:32 +02:00
Christopher Gjelten e05f543cb0 Fix: Player ready stuff (#241) 2021-05-23 15:34:17 +02:00
RockySouthpaw a103ef9b2f FIX: Prevent crouch when pasting into phone. 2021-05-22 01:19:35 -04:00
Christopher fb32aaef15 fix(phone): only listen to UI Ready 2021-05-21 00:35:05 +02:00
Dillon Skaggs 2411c39b95 Fix double call history & adding contact from history (#231) 2021-05-20 23:54:01 +02:00
Dillon Skaggs 488c8df5cb feat(client/call): make pma-voice the default export (#232)
- mumble-voip is no longer maintained and is recommended to not be used.
2021-05-20 14:43:28 -04:00
Christopher 054f89c03d fix(phone): fixed? 2021-05-20 18:29:01 +02:00
Christopher 2f0f83a17e fix(resources): load config when player spawns
this is a solution for standalone
2021-05-20 16:42:34 +02:00
Christopher d279b31b8f chore(phone): remove useless sendMessage 2021-05-18 13:13:31 +02:00
Christopher 2bd4f4dc96 fix(phone): remove checks for phoneReady 2021-05-18 13:10:48 +02:00
Christopher 346d194e97 fix(resources): use database config for sql queries 2021-05-16 02:39:19 +02:00
Christopher f89ffc3060 fix(init): remove player/ui ready events 2021-05-16 02:20:17 +02:00
Christopher c5aaf32e5d fix(sql): varchar limit for contact display 2021-05-16 02:04:43 +02:00
Christopher Gjelten 7d447c118c Merge pull request #211 from project-error/cleanup/config
Cleanup of Config + Runtime Reference, Not Compile
2021-05-16 02:00:48 +02:00
Christopher Gjelten 0134b9052c Merge branch 'master' into cleanup/config 2021-05-16 01:57:30 +02:00
Christopher 46484be9bc fix(calls): check if player does not exist --no-verify 2021-05-15 05:08:51 +02:00
Christopher Gjelten 951ed914d5 Merge pull request #212 from project-error/feat/keep-input 2021-05-14 02:29:37 +02:00
Darrian d5aaa67c6c Fix: Removed net event. 2021-05-12 02:38:11 -04:00
dependabot[bot] d18ebc066b chore(deps): bump handlebars from 4.7.6 to 4.7.7 (#224)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-09 11:07:37 -04:00
dependabot[bot] aa8648c408 chore(deps): bump hosted-git-info from 2.8.8 to 2.8.9 (#225)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-09 11:07:22 -04:00
Christopher aa5eb4be2d fix(resources/calls): emit events for start and accepting calls 2021-05-09 15:18:18 +02:00
Christopher b92cf0d6fa fix(resources/messages): fix coercion comparsion 2021-05-09 15:15:20 +02:00
victorBOY ea69ba4667 Update ptbr.json (#222) 2021-05-07 15:03:28 -04:00
Taso 4c3d018751 chore(husky): enforce commit conventions in precommit script 2021-05-04 23:58:58 -04:00
Taso 1fe8541476 fix(server/players): Handle new player event in controller
For some reason this event actually lacked the new player handle
2021-05-04 23:32:48 -04:00
Christopher fd6afa927c fix(resources/notes): fetch notes after adding 2021-05-04 17:48:24 +02:00
Christopher Gjelten f53117971e Merge pull request #205 from project-error/feat/public-api
feat(player/npwd): Public facing API
2021-05-04 11:17:16 +02:00
dependabot[bot] 4b705da072 chore(deps): bump ssri from 6.0.1 to 6.0.2 (#219)
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-02 22:17:11 -04:00
dependabot[bot] 532a554b77 chore(deps): bump ssri from 6.0.1 to 6.0.2 in /resources (#218)
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-02 22:17:02 -04:00
Franco Sanllehi 1ac4b6dd8d tweak(lerna/setup): Slightly tweak setup for lerna monorepo
* Added @octokit/core (peer-dep for lerna)
* Added yarn bootstrap on post-install script to automatically bootstrap lerna repo
2021-05-02 22:15:24 -04:00
Franco Sanllehi ba8f722c35 Update es.json (#220)
* Update es.json

* Update es.json

* Update es.json
2021-05-02 02:44:39 -04:00
J Francisco Rader faf4edfbc6 Tweak / Effect dependencies and Fivem-Nui-lib (#216)
* Fix Nui.send effect dependencies and upgrade lib to fixed version

* Remove log
2021-04-30 22:52:35 +02:00
nullptr 34b177e827 Hungarian translation (#217) 2021-04-30 12:06:16 +02:00
クリストファー 1030ae158c Update README.md 2021-04-26 17:13:56 +02:00
Christopher 4f658181d2 fix(resources/server): fix imports 2021-04-26 17:07:57 +02:00
Darrian 000151e756 Fix: Disable additional controls. 2021-04-22 13:24:23 -04:00
Darrian 80d2d5476a Fix: Additional disable controls for vehicles + chat. 2021-04-22 12:59:49 -04:00
Darrian 95ed68dff6 RFR: Renamed file, adjusted manifest, and refactored code.
Renamed the event so its more clear what it does and added a bool to denote when it's being disabled or not. This was attached to `isPhoneOpen` which wasn't reliablly working.  Its now done within `showPhone` and `hidePhone`.

The wait was changed from `1000` to `100` in the event the phone is opened before the wait is over. Makes it more smooth as there is no longer a small duration where the mouse moves the camera.

Removed the enable of control actions as it wasn't needed.
2021-04-22 12:32:10 -04:00
Christopher 10e28b911e refactor(resources/photo): refactor photos 2021-04-21 14:34:07 +02:00
Christopher 3470700fc1 fix(resources/messages): actaully use the class property 2021-04-21 14:18:45 +02:00
Christopher 8efcf2e5b5 refactor(resources/messages): refactor messages 2021-04-21 14:01:10 +02:00
Christopher ed05ebd6a8 Merge branch 'feat/public-api' of https://github.com/project-error/new-phone-who-dis into feat/public-api 2021-04-20 13:50:33 +02:00
Christopher cd4f7e73a6 feat(resources): refactor marketplace 2021-04-19 14:14:26 -04:00
Christopher 4803753cfa fix(contacts): dont send a object when deleting a contact 2021-04-19 14:14:25 -04:00
Taso 85d4ab3c36 fix(client/twitter): Fixed profile fetch 2021-04-19 14:14:25 -04:00
Taso 3304ae9a83 fix(phone/marketplace): Fix open fetch event 2021-04-19 14:14:25 -04:00
Taso 53fbf07984 tweak(server): Add some service instantiation logs 2021-04-19 14:14:25 -04:00
Taso 9724014a9a fix(server): Actually reference PlayerService method 2021-04-19 14:14:25 -04:00
Taso 8988ea9b26 fix(server): Actually import the correct controllers 2021-04-19 14:14:25 -04:00
Taso a0c80a0e9a fix(server/notes): Temporarily use old resp format 2021-04-19 14:14:25 -04:00
Taso 048753f6d2 fix(server/contacts): Use old response structure for time being 2021-04-19 14:14:25 -04:00
Taso 4687635988 fix(client/calls): Fix call history not fetching properly 2021-04-19 14:14:25 -04:00
Taso 93fd955ae9 fix(server): Fix server's referencing old player system 2021-04-19 14:14:25 -04:00
Taso 25a629a59b feat(net-events): Initial opinionated promise wrapper around net events
Lets see how I & the rest of the team feel about this specific standard and we can tweak it from there.
2021-04-19 14:14:25 -04:00
Taso f8f722c8d2 refactor(server/contacts): Implement singleton architecture 2021-04-19 14:14:25 -04:00
Taso 16471ed1df feat(server/types): Play around with a standardized resp type 2021-04-19 14:14:25 -04:00
Taso feb9e8a5d3 refactor(server/notes): Implement singleton architecture
Also trying something out with the response structure on the server to cut down on redundant calls.
2021-04-19 14:14:25 -04:00
Taso 0f8923058f tweak(server/calls): Tweaked structure and added enum constants 2021-04-19 14:14:24 -04:00
Taso 06a67f14cd tweak(server/player): Tweaked structure slightly 2021-04-19 14:14:24 -04:00
Taso cb9c490cb5 refactor(server/calls): Calls singleton architecture 2021-04-19 14:14:24 -04:00
Taso 33a02bb203 refactor(server/player): Player singleton architecture 2021-04-19 14:14:24 -04:00
Taso 19e4ba0543 WIP 2021-04-19 14:14:24 -04:00
Taso 85eb58948d tweak(player): Altered PLAYER_IS_READY event to emit a bool
This will set the client var to true when NPWD loads a player and false when NPWD unloads a player.
2021-04-19 14:14:24 -04:00
Taso 558f2388fc refactor(server/players): Take a different approach to multichar
This changes how multicharacter support is implemented entirely.

Instead there are now events for creating a new player & unloading a player. These should be called whenever a character is switched. Documentation will be added for `npwd:newPlayer` & `npwd:unloadPlayer`
2021-04-19 14:14:24 -04:00
Taso 222070eeea fix(server/players): Aliased global.exports 2021-04-19 14:14:24 -04:00
Taso 6be602c95b feat(player/npwd): Update identifier & name
Still need to include a public facing phone number update
2021-04-19 14:14:24 -04:00
Taso 3e01fc456c tweak(phone): Split Phone component into wrapper 2021-04-19 13:28:10 -04:00
Taso 4b7a6280fd fix(phone/notes): Fixed slide transition with notes modal 2021-04-19 13:15:55 -04:00
Taso ec4ebdc54d tweak(phone): Rename PhoneContainer 2021-04-19 13:15:33 -04:00
Christopher 0df1c123b0 feat(resources): refactor marketplace 2021-04-19 19:13:56 +02:00
Christopher 6c9e2aef04 fix(contacts): dont send a object when deleting a contact 2021-04-18 21:51:41 +02:00
Taso 478d4d4519 fix(client/twitter): Fixed profile fetch 2021-04-18 15:38:51 -04:00
Taso 046aeffb76 fix(phone/marketplace): Fix open fetch event 2021-04-18 15:38:51 -04:00
Taso 0de2495bfa tweak(server): Add some service instantiation logs 2021-04-18 15:38:51 -04:00
Taso ad7adcdeb6 fix(server): Actually reference PlayerService method 2021-04-18 15:38:51 -04:00
Taso af9ff9c92f fix(server): Actually import the correct controllers 2021-04-18 15:38:51 -04:00
Taso 8af7530f18 fix(server/notes): Temporarily use old resp format 2021-04-18 15:38:51 -04:00
Taso 635dc907ce fix(server/contacts): Use old response structure for time being 2021-04-18 15:38:51 -04:00
Taso caf42c9c8a fix(client/calls): Fix call history not fetching properly 2021-04-18 15:38:51 -04:00
Taso 2dafbcc13f fix(server): Fix server's referencing old player system 2021-04-18 15:38:51 -04:00
Taso 51b5620866 feat(net-events): Initial opinionated promise wrapper around net events
Lets see how I & the rest of the team feel about this specific standard and we can tweak it from there.
2021-04-18 15:38:51 -04:00
Taso c94c69c646 refactor(server/contacts): Implement singleton architecture 2021-04-18 15:38:51 -04:00
Taso b684656379 feat(server/types): Play around with a standardized resp type 2021-04-18 15:38:51 -04:00
Taso 0bb20fff31 refactor(server/notes): Implement singleton architecture
Also trying something out with the response structure on the server to cut down on redundant calls.
2021-04-18 15:38:51 -04:00
Taso d93bdd20d8 tweak(server/calls): Tweaked structure and added enum constants 2021-04-18 15:38:51 -04:00
Taso b051ae9fac tweak(server/player): Tweaked structure slightly 2021-04-18 15:38:51 -04:00
Taso bf95ccb06b refactor(server/calls): Calls singleton architecture 2021-04-18 15:38:51 -04:00
Taso bb7d938b07 refactor(server/player): Player singleton architecture 2021-04-18 15:38:51 -04:00
Taso e01fa0ab0a WIP 2021-04-18 15:38:50 -04:00
Taso 949ea4ba4b tweak(player): Altered PLAYER_IS_READY event to emit a bool
This will set the client var to true when NPWD loads a player and false when NPWD unloads a player.
2021-04-18 15:38:50 -04:00
Taso 268bd4f4a4 refactor(server/players): Take a different approach to multichar
This changes how multicharacter support is implemented entirely.

Instead there are now events for creating a new player & unloading a player. These should be called whenever a character is switched. Documentation will be added for `npwd:newPlayer` & `npwd:unloadPlayer`
2021-04-18 15:38:50 -04:00
Taso 2ec049ca12 fix(server/players): Aliased global.exports 2021-04-18 15:38:50 -04:00
Taso db03394487 feat(player/npwd): Update identifier & name
Still need to include a public facing phone number update
2021-04-18 15:38:50 -04:00
Christopher 8861f4e503 fix(phone): remove Nui deps from useEffect 2021-04-18 21:37:47 +02:00
Christopher 6a46711a51 feat(phone/marketplace): choose images from camera 2021-04-16 15:34:45 +02:00
Christopher 1c69cd5e2e keep input 2021-04-16 09:10:10 +02:00
Taso b14562eb9d tweak(phone): Remove FontAwesome dependency
All icons were switched to @material-ui/icons
2021-04-13 22:49:05 -04:00
Taso af2b7519b6 chore(phone): Remove cp-cli dep 2021-04-13 22:09:18 -04:00
Taso dd3eac4a0e tweak(config): Config var & send as event method
config -> ResourceConfig for readability and the resource config in NUI is now being referenced consistently from state so it can be referenced at runtime and not compile time.

Also removes the need to copy the config before using `cp`
2021-04-13 22:07:22 -04:00
Taso 8ce6ec7559 fix(config): Fixed typos in resource config 2021-04-13 22:06:43 -04:00
Taso 60e38c9e5c tweak(phone/default-config): Readability differentiation for config
Makes the difference between the NUI specific build time config & the resource runtime resource config more apparent.
2021-04-13 22:06:43 -04:00
Taso 71bb73b54e fix(phone/watch): Fixed in-game watch and prevent debug inject
If using the `watch` script in game, the debug injections will not occur.
2021-04-13 22:04:23 -04:00
J Francisco RaderandTaso 8dc59c47bd fix(phone): Fix subsequent rerenders & added WDYR (#209)
Fixed an issue with infinite rerendering on app routes by making it a Pure component.

Adds `why-did-you-render` for development use.

Co-authored-by: Taso <[email protected]>
2021-04-13 21:33:18 -04:00
Taso 4fceb3750b tweak(phone/deps): Remove @types/jest as we use enzyme 2021-04-13 21:24:25 -04:00
Taso 771483b7b5 fix(phone/watch): Implement watch using craco and writing to disk 2021-04-13 21:24:25 -04:00
Taso 1ef01f291b fix(phone/tests): Fixed enzyme test for React 17 2021-04-13 21:24:25 -04:00
Taso 6154dfc7a3 tweak(phone): Bumped deps & tweaked craco
This updates our craco config to match our current custom webpack build rather than having to eject. This also bumps several of our dependencies that were outdated for React 17.
2021-04-13 21:24:25 -04:00
Taso ecd7689742 fix(phone/icons): Fixed messages icon having text in d attr 2021-04-13 20:21:24 -04:00
Taso 2b4752dc89 fix(phone/number): Fix incorrect method ref on setNumber in dev 2021-04-13 19:49:01 -04:00
Taso bd5f3016d0 tweak(phone/settings): Remove button effect on switches 2021-04-13 19:48:44 -04:00
Taso fad2ff14fa fix(scripts/client): Fix incorrect ready & config method 2021-04-13 16:49:35 -04:00
Taso 390319deda fix(types): Fixed incorrectly referenced type 2021-04-11 10:32:31 -04:00
Taso b5fca6b35b cleanup: Recoil State Type Safety + Misc Cleanup (#189)
* chore(phone/settings): Removed unused state

* cleanup(phone/photos): Added type safety to photo state

* tweak(phone/marketplace): Added type safety to marketplace state

* chore(phone/match): Removed unnecessary console.log

* tweak(phone/messages): Added type safety to messages state

Also fixed ESLint warning for exported anonymous hook in useMessages.ts

* tweak(phone/match): Added type safety to match state

* tweak(phone/dialer): Cleanup & type safety for state

Renamed some types to better represent their data

* cleanup(phone/gen): Added NUI event enums for phone events

* tweak(phone/contacts): Type safety for contacts state & variable rename

Renamed and type variable in setFilteredContacts to better represent its use

* tweak(phone/gen-state): Added type-safety to gen phone global state

* tweak(phone/settings): Type safety for settings state

* tweak(phone/photos): Tweaked type for photo referral

* fix(phone/notification-comp): Fix reference to old theme config

* chore(phone/hooks): Remove keyboard service

Removed as this was unused and ESLint was not happy with it

* chore(phone): Cleaned up eslint warnings

No more warnings hooray!

* tweak(phone): Set time in dev mode

* fix(phone): Remove useNuiService that appeared somehow

* fix(phone/gallery): Fixed missing import for gallery

* Revert removing the keyboard service as this is built upon in another PR

This reverts commit 82d12255a84e918da087d988b599af98ce1fe54d.

* fix(phone/keyboard): Add useKeyboardService hook back to Phone.tsx

* fix(phone/gallery): Fix and standardized GalleryPhoto type
2021-04-11 10:01:38 -04:00
Taso 1f20b980da fix(phone/gallery): Fix forgotten handle function 2021-04-11 09:45:17 -04:00
Taso a880ae66ea feat(config): Allow config to be edited without rebuild 2021-04-11 09:38:20 -04:00
Taso 1a3d02f1e3 fix(husky): Readd missing precommit script 2021-04-11 09:05:09 -04:00
J Francisco Rader b97cc4102d Feature / Add loading state to camera app (#200)
* (feat/camera-loading): Add loading state to camera app

* Fix imports + Add timeout

* Use actual function :D
2021-04-10 16:19:25 -03:00
dayiskuan e1e6e8440d Adding new icons (#204)
* Adding new icons
2021-04-10 14:49:15 -03:00
Oldarorn 404d526863 Adding french missing translations (#203)
french baguette ♫
2021-04-09 16:06:24 +02:00
J Francisco Rader e70c540ce8 Fix fetch on initialize (fixing notifications too) (#202)
* Fix fetch on initialize (fixing notifications too)

* Add multiline support to messages input field
2021-04-08 10:53:12 -03:00
Christopher 62038aa5fe tweak(phone/wallpaper): current wallpaper value as initial input value 2021-04-08 11:00:52 +02:00
J Francisco Rader 8e79eb1345 Make use of library instead of having code duplicated (#201)
* Use fivem-nui-react-lib
2021-04-07 19:07:10 -03:00
Christopher Gjelten 0cf5bc2bc7 tweak(phone/settings): simplify custom background (#185)
Adds the custom background option into wallpaper SettingItem, with an nice DialogForm.
2021-04-07 23:29:18 +02:00
Taso 8ef1a0aa9a tweak(scripts): Tweaked root lerna scripts
Tweaked root package.json scripts to better improve dev experience.

* Install npm dependencies for both packages using `yarn bootstrap` in root directory

* Build both NUI and game scripts using `yarn build` in the root directory.

* Precommit git hook references script rather than global pretty-quick
2021-04-05 20:12:34 -04:00
Taso 2a8230e505 chore(husky): Removed unnecessary committed files 2021-04-05 20:08:14 -04:00
RockySouthpaw fcecd2aa89 chore(sql): Adjust identifier length & remove items 2021-04-05 17:27:35 -04:00
Christopher Gjelten d8dc5b7f47 Update README.md 2021-04-04 16:45:47 +02:00
Christopher fed7b2c13a Merge branch 'master' of https://github.com/project-error/new-phone-who-dis 2021-04-04 02:44:39 +02:00
Christopher d6b561beb8 remove unusded variable 2021-04-04 02:41:47 +02:00
Taso 8ca8b1b5fe tweak(phone/call-modal): Tweaked appearance of call modal (#178)
Correct actions will now display if calling another player.

Also added ringing flavor text when the person calling is the transmitter.
2021-04-03 18:02:47 -04:00
Christopher 4bf3248168 tweak(phone/dialer): remove type number from dialer input
this is temporary
2021-04-03 22:32:09 +02:00
J Francisco Rader cb1aa80f83 bugfix(messages-app): Remove paste from clipboard feature (#195) 2021-04-02 18:04:44 -03:00
J Francisco Rader 9896f2384e Add kiddo theme :D 2021-04-01 16:07:32 -03:00
Taso 289207beb9 tweak(phone/twitter): Refactored nui events to use enums for method" 2021-04-01 12:37:56 -04:00
Taso 8bfdc1b8b2 fix(phone/types): Replaced debug inject methods with new enums" 2021-04-01 12:28:14 -04:00
J Francisco Rader d315d72e93 Fix first time login 2021-04-01 11:42:28 -03:00
Christopher 2992a644fe tweak(phone/apps): hiding bank app while bank resource gets done 2021-04-01 14:31:38 +02:00
victorBOY 2b633c9e80 Update pt-BR translation (#188)
* Update pt-BR translation

* Update ptbr.json

* Fix missing translations
2021-03-31 22:58:40 +02:00
Christopher dab4c1eaf7 fix(phone/dialer): missing translation 2021-03-31 20:47:39 +02:00
Dillon Skaggs 48e0dd2443 fix(sql): don't include extra SQL data (#187) 2021-03-31 15:10:34 -03:00
Christopher 3157cafd5a fix(phone/settings): fix settingsSchema properties for custom wallpaper 2021-03-30 22:30:05 +02:00
Christopher c82a48b012 remove slutty import, smh' 2021-03-30 22:23:32 +02:00
Christopher 4d46566811 feat(phone/settings): custom background 2021-03-30 22:21:41 +02:00
Christopher ee7e3a3ae1 tweak(phone/twitter): change position of tweet & showMore button 2021-03-30 16:27:07 +02:00
Christopher 31241c7e8f Merge branch 'master' of https://github.com/project-error/new-phone-who-dis 2021-03-30 16:06:04 +02:00
Christopher 5f2dce2dda fix(phone/marketplace): use enums events for injectData 2021-03-30 16:05:39 +02:00
J Francisco Rader 107dc43624 Improve messages error handling (#181)
* Improve messages error handling

* Add types to getPlayerFromIdentifier function

* Add phone validation regex to message group form

* Add correct alert types to enum

* Improve locale

* Improve error message for unregistered numbers
2021-03-29 18:55:27 -04:00
Christopher f27e486ff5 fix(phone/marketplace): fix word wrap 2021-03-28 23:32:02 +02:00
Christopher Gjelten a88286f97a Improve/marketplace (#184)
Overall fixes for sellout => marketplace.
2021-03-28 04:20:12 +02:00
Christopher baf6dedb6f update en.json 2021-03-28 01:31:49 +01:00
Christopher Gjelten c5115777c5 Merge pull request #177 from project-error/feat/bank-enums
Feat(phone): Update to use all enums.
2021-03-27 17:20:31 +01:00
Christopher d95cd8d4bc fix(phone/dialer): only allow numbers in input 2021-03-27 00:12:40 +01:00
Oldarorn 632e27e0fa Tinder french translation (#183)
Because love can't wait
2021-03-26 14:10:47 -04:00
Taso 853b335ef9 feat(phone): Added a game time indicator to top bar (#176) 2021-03-26 13:30:09 -04:00
Erik 6b865f2e73 Feature/tinder (#179)
* basic framework for match/tinder

* working version of swiping

* working version of profile editing

* introducing backend

* working matching system

* working profile updating

* fix all linting issues

* updated events to Enum

* working profile generation

* documentation updates

* general PR feedback

* working profile loading, matches show matchedAt

* slight modification to event strings

* added sql imports
2021-03-26 13:29:51 -04:00
Christopher Gjelten b02b19be5f Merge pull request #182 from Oldarorn/patch-5
Added missing french translations
2021-03-26 16:33:17 +01:00
Oldarorn 0bb9b6738f Added missing french translations
I was passing by your repo and saw some translations were missing so... here I am ♫
2021-03-26 13:01:21 +01:00
Christopher a6f98d7ac0 update marketplace enums 2021-03-25 13:07:07 +01:00
Christopher 5ce6cf2d4a update notes enums 2021-03-25 12:53:18 +01:00
Christopher 2e4d752cd3 update conatct enums 2021-03-25 11:42:44 +01:00
Christopher 2cd3e9e93d update dial events 2021-03-25 11:31:05 +01:00
Christopher 98efed4e64 fix bank enums 2021-03-24 19:02:02 +01:00
Christopher de10ce92b2 fix(bank): update all events 2021-03-22 23:15:02 +01:00
Christopher 5654e1f46f feat(bank): update usage of enums 2021-03-22 23:05:39 +01:00
403 changed files with 15812 additions and 11829 deletions

No files matched your search

+19 -11
View File
@@ -1,6 +1,6 @@
name: Test Suite
on: [push]
on: [push, pull_request]
jobs:
nui_preformatting_tests:
@@ -13,11 +13,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
# This is important to fetch the changes to the previous commit
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -36,6 +31,8 @@ jobs:
run: yarn --frozen-lockfile
- name: Run Enzyme Tests
run: yarn test
- name: Check build status
run: yarn build
env:
CI: true
@@ -49,11 +46,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
# This is important to fetch the changes to the previous commit
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v1
with:
@@ -62,5 +54,21 @@ jobs:
run: yarn --frozen-lockfile
- name: Run Jest Tests
run: yarn test
- name: Check build status
run: yarn build
env:
CI: true
lint:
name: Lint Lua scripts
runs-on: ubuntu-latest
defaults:
run:
working-directory: resources
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Lint
uses: GoatG33k/fivem-lua-lint-action@v1
+57
View File
@@ -0,0 +1,57 @@
name: Prerelease Publisher
on:
push:
branches:
- master
jobs:
pre-release-build:
name: 'Build & Create Pre-Release'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Setup Node and Yarn Cache
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'yarn'
# Get zip util
- name: Install archive tools
run: sudo apt install zip
- name: Get variables
id: get_vars
run: |
echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)"
echo "::set-output name=DATE::$(date +'%D')"
- name: Install Deps
run: yarn --frozen-lockfile
- name: Run build
run: yarn build
- name: Bundle and Zip files
run: |
mkdir -p ./temp/npwd/resources
cp ./{LICENSE,README.md,config.json,import.sql,fxmanifest.lua} ./temp/npwd/
cp -r ./resources/{dist,html} ./temp/npwd/resources
cd ./temp && zip -r npwd-pre-${{ steps.get_vars.outputs.SHORT_SHA }}.zip ./npwd
- name: Create Release & Changelog
uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: Pre-Release Build (${{ steps.get_vars.outputs.SHORT_SHA }}) | ${{ steps.get_vars.outputs.DATE }}
prerelease: true
automatic_release_tag: "unstable"
files: ./temp/npwd-pre-${{ steps.get_vars.outputs.SHORT_SHA }}.zip
env:
CI: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+107
View File
@@ -0,0 +1,107 @@
name: Tagged Release Publisher
on:
push:
tags:
- "*"
jobs:
bump-version:
name: Bump Version
runs-on: ubuntu-latest
outputs:
VERSION_TAG: ${{ steps.get_version_tag.outputs.VERSION_TAG }}
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Get Version Tag
id: get_version_tag
run: echo ::set-output name=VERSION_TAG::${GITHUB_REF/refs\/tags\//}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Bump package shells
run: |
cd phone && npm version ${{ needs.bump-version.outputs.VERSION_TAG }}
cd resources && npm version ${{ needs.bump-version.outputs.VERSION_TAG }}
git status
- name: Commit and push
uses: EndBug/[email protected]
with:
message: Bump version to v${{ needs.bump-version.outputs.VERSION_TAG }}
default_author: github_actions
branch: master
add: |
phone/package.json
resources/package.json
create-tagged-release:
name: Build and Create Tagged Release
runs-on: ubuntu-latest
needs: bump-version
steps:
- name: Install archive tools
run: sudo apt install zip
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install dependencies
run: yarn
- name: Run build
run: yarn build
- name: Create Sentry Release (NPWD)
uses: tclindner/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: 'project-error'
SENTRY_PROJECT: 'npwd'
SENTRY_URL: https://sentry.projecterror.dev/
SENTRY_LOG_LEVEL: debug
with:
environment: production
tagName: ${{ needs.bump-version.outputs.VERSION_TAG }}
sourceMapOptions: './resources/html/static/js'
- name: Create Sentry Release (NodeJS)
uses: tclindner/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: 'project-error'
SENTRY_PROJECT: 'npwd-s'
SENTRY_URL: https://sentry.projecterror.dev/
with:
environment: production
tagName: ${{ steps.get_vars.outputs.VERSION_TAG }}
sourceMapOptions: './resources/html/static/js'
- name: Bundle built files
run: |
mkdir -p ./temp/npwd/resources
cp ./{LICENSE,README.md,config.json,import.sql,fxmanifest.lua} ./temp/npwd/
cp -r ./resources/{dist,html} ./temp/npwd/resources
cd ./temp && zip -r npwd-${{ needs.bump-version.outputs.VERSION_TAG }}.zip ./npwd
- name: Create Release
uses: "marvinpinto/[email protected]"
id: auto_release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: NPWD Release | ${{ needs.bump-version.outputs.VERSION_TAG }}
prerelease: false
files: npwd-${{ needs.bump-version.outputs.VERSION_TAG }}.zip
env:
CI: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+6 -1
View File
@@ -1,6 +1,8 @@
# No IDE Folders
.idea
npwd_temp
resources/html
phone/.eslintcache
@@ -19,4 +21,7 @@ yarn-error.log*
.DS_Store
# Debug logs
sv_npwd.log
sv_npwd.log
# FXServer Yarn
.yarn.installed
-30
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit ""
-5
View File
@@ -1,5 +0,0 @@
Kidz
ItsChip
ROCKY_southpaw
Kire
TasoOneAsia
+97 -594
View File
@@ -1,594 +1,97 @@
GNU General Public License
==========================
_Version 3, 29 June 2007_
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
## 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
&lt;<http://www.gnu.org/licenses/>&gt;.
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
&lt;<http://www.gnu.org/philosophy/why-not-lgpl.html>&gt;.
Copyright (c) Kidz, ItsChip, ROCKY_southpaw, Kire and TasoOneAsia
All rights reserved.
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 – Scope.
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 – License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution.
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 – Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 – Term and Termination.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 – Other Terms and Conditions.
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 – Interpretation.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
+13 -31
View File
@@ -1,8 +1,9 @@
# New-Phone-Who-Dis (NPWD)
<img src="https://beta.iodine.gg/zVkK7.png" width="500" height="300" />
<img src="https://i.file.glass/zVkK7.png" width="500" height="300" />
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.
NPWD is our flagship and current running project. The team has been working on the project since August, 2020. This resource isn’t complete yet and currently has a pre-release. There is however no ETA for a stable release, yet. Feel free to test it out in a dev environment by following the installation guide.
Written completely by the Project Error Dev Team in [React](https://reactjs.org/) with a [TypeScript](https://www.typescriptlang.org/) client/server environment.
@@ -35,32 +36,13 @@ We do not want issues opened that are due to the phone being **WIP** as this slo
Most of these apps have UI that does **not** represent the final product and are subject to change.
- [**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)
## License
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/>.
- [**Bank**](https://i.file.glass/Eh53X.png)
- [**Calculator**](https://i.file.glass/s6VQV.png)
- [**Camera**](https://i.file.glass/vW0y9.png)
- [**Contacts**](https://i.file.glass/3fujR.png)
- [**Marketplace**](https://i.file.glass/5bUa8.png)
- [**Messages**](https://i.file.glass/S4Lia.png)
- [**Notes**](https://i.file.glass/qTkBb.png)
- [**Phone**](https://i.file.glass/z0ii9.png)
- [**Settings**](https://i.file.glass/mZAIt.png)
- [**Twitter**](https://i.file.glass/rQZFR.png)
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
+19 -14
View File
@@ -1,23 +1,23 @@
{
"Locale": "en",
"KeyTogglePhone": 288,
"KeyTakeCall": 38,
"PhoneAsItem": false,
"SwimDestroy": false,
"RunRate": 10,
"DestoryChance": 100,
"DestroyPhoneReCheck": 3,
"notificationPosition": {
"horizontal": "right",
"vertical": "top"
"PhoneAsItem": {
"enabled": false,
"exportResource": "my-core-resource",
"exportName": "myCheckerFunction"
},
"general": {
"useDashNumber": true
"useDashNumber": true,
"enableMultiChar": false
},
"database": {
"useIdentifierPrefix": false,
"playerTable": "users",
"identifierColumn": "identifier"
},
"twitter": {
"showNotifications": true,
"generateProfileNameFromUsers": true,
"allowEdtiableProfileName": true,
"allowEditableProfileName": true,
"allowDeleteTweets": true,
"allowReportTweets": true,
"characterLimit": 160,
@@ -27,11 +27,16 @@
"enableImages": true,
"maxImages": 3
},
"match": {
"generateProfileNameFromUsers": true,
"allowEditableProfileName": true
},
"bank": {
"showNotifications": true
},
"debug": {
"level": "debug",
"enabled": true
"level": "silly",
"enabled": true,
"sentryEnabled": true
}
}
+5 -5
View File
@@ -3,8 +3,9 @@ game "gta5"
description 'js runtime monkaW'
authors { "itschip", "erik-sn", "TasoOneAsia", "kidz", "RockySouthpaw"}
client_script {
'resources/dist/client/*.client.js'
client_scripts {
'resources/dist/client/*.client.js',
'resources/client/*.lua'
}
server_script {
@@ -14,8 +15,7 @@ server_script {
ui_page 'resources/html/index.html'
files {
'config.json',
'resources/html/index.html',
'resources/html/*.js',
'resources/html/*.map',
'resources/html/media/**/*'
'resources/html/**/*',
}
+69 -54
View File
@@ -1,15 +1,13 @@
# comment this out if your server has a different table/location for phone_number
# or if it already exists in the users table
ALTER TABLE `users` ADD COLUMN `phone_number` VARCHAR(20) DEFAULT NULL;
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('phone', 'Phone', 1, 0, 1);
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('dphone', 'Destroyed Phone', 1, 0, 1);
CREATE TABLE IF NOT EXISTS npwd_phone_contacts (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(60) DEFAULT NULL,
avatar varchar(512) DEFAULT NULL,
number varchar(10) DEFAULT NULL,
display varchar(60) NOT NULL DEFAULT '',
CREATE TABLE IF NOT EXISTS `npwd_phone_contacts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL,
`avatar` varchar(512) DEFAULT NULL,
`number` varchar(12) DEFAULT NULL,
`display` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (id)
);
@@ -19,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`likes` int NOT NULL DEFAULT '0',
`identifier` varchar(40) NOT NULL,
`identifier` varchar(48) NOT NULL,
`visible` tinyint NOT NULL DEFAULT '1',
`images` varchar(1000) DEFAULT '',
`retweet` int DEFAULT NULL,
@@ -30,9 +28,9 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
`id` int NOT NULL AUTO_INCREMENT,
`profile_name` varchar(90) NOT NULL,
`identifier` varchar(40) NOT NULL,
`identifier` varchar(48) NOT NULL,
# Default Profile avatar can be set here
`avatar_url` varchar(255) DEFAULT 'https://beta.iodine.gg/QrEvq.png',
`avatar_url` varchar(255) DEFAULT 'https://i.file.glass/QrEvq.png',
`bio` varchar(512) DEFAULT NULL,
`location` varchar(45) DEFAULT NULL,
`job` varchar(45) DEFAULT NULL,
@@ -54,33 +52,60 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` (
CONSTRAINT `tweet` FOREIGN KEY (`tweet_id`) REFERENCES `npwd_twitter_tweets` (`id`) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
`id` int NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) NOT NULL,
`name` varchar(90) NOT NULL,
`image` varchar(255) NOT NULL,
`bio` varchar(512) DEFAULT NULL,
`location` varchar(45) DEFAULT NULL,
`job` varchar(45) DEFAULT NULL,
`tags` varchar(255) NOT NULL DEFAULT '',
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`),
UNIQUE KEY `identifier_UNIQUE` (`identifier`)
);
CREATE TABLE IF NOT EXISTS npwd_notes (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) NOT NULL,
title varchar(255) NOT NULL,
content varchar(255) NOT NULL,
CREATE TABLE IF NOT EXISTS `npwd_match_views` (
`id` int NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) NOT NULL,
`profile` int NOT NULL,
`liked` tinyint DEFAULT '0',
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `match_profile_idx` (`profile`),
CONSTRAINT `match_profile` FOREIGN KEY (`profile`) REFERENCES `npwd_match_profiles` (`id`)
);
CREATE TABLE IF NOT EXISTS `npwd_notes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) NOT NULL,
`title` varchar(255) NOT NULL,
`content` varchar(255) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS npwd_marketplace_listings (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) DEFAULT NULL,
username varchar(255) DEFAULT NULL,
name varchar(50) DEFAULT NULL,
number varchar(255) NOT NULL,
title varchar(255) DEFAULT NULL,
url varchar(255) DEFAULT NULL,
description varchar(255) NOT NULL,
createdAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updatedAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
CREATE TABLE IF NOT EXISTS `npwd_marketplace_listings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`number` varchar(255) NOT NULL,
`title` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`description` varchar(255) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
id int(11) NOT NULL AUTO_INCREMENT,
listing_id int(11) DEFAULT NULL,
profile varchar(255) DEFAULT NULL,
CREATE TABLE IF NOT EXISTS `npwd_marketplace_reports` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`listing_id` int(11) DEFAULT NULL,
`profile` varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
@@ -98,30 +123,20 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
`id` int NOT NULL AUTO_INCREMENT,
`user_identifier` varchar(40) NOT NULL,
`user_identifier` varchar(48) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`group_id` varchar(512) NOT NULL,
`participant_identifier` varchar(40) NOT NULL,
`participant_identifier` varchar(48) NOT NULL,
`label` varchar(60) DEFAULT '',
`unreadCount` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
`id` int NOT NULL AUTO_INCREMENT,
`user_identifier` varchar(40) NOT NULL,
`label` varchar(60) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`group_id` varchar(512) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `npwd_messages` (
`id` int NOT NULL AUTO_INCREMENT,
`message` varchar(512) NOT NULL,
`user_identifier` varchar(40) NOT NULL,
`user_identifier` varchar(48) NOT NULL,
`group_id` varchar(512) NOT NULL,
`isRead` tinyint NOT NULL DEFAULT '0',
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -130,20 +145,20 @@ CREATE TABLE IF NOT EXISTS `npwd_messages` (
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS npwd_calls (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) DEFAULT NULL,
transmitter varchar(255) NOT NULL,
receiver varchar(255) NOT NULL,
is_accepted tinyint(4) DEFAULT 0,
start varchar(255) DEFAULT NULL,
CREATE TABLE IF NOT EXISTS `npwd_calls` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL,
`transmitter` varchar(255) NOT NULL,
`receiver` varchar(255) NOT NULL,
`is_accepted` tinyint(4) DEFAULT 0,
`start` varchar(255) DEFAULT NULL,
end varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS npwd_phone_gallery (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) DEFAULT NULL,
image varchar(255) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
+13 -3
View File
@@ -1,19 +1,29 @@
{
"name": "npwd",
"version": "0.1.0",
"description": "A FiveM phone resource, made in React & TypeScript",
"repository": "https://github.com/project-error/new-phone-who-dis",
"license": "CC-BY-NC-SA-4.0",
"devDependencies": {
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@octokit/core": "^3.4.0",
"husky": "^5.1.3",
"lerna": "^3.22.1",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0"
},
"scripts": {
"build": "lerna run build --concurrency 1",
"build": "lerna run test && lerna run build",
"prepare": "husky install",
"format": "pretty-quick"
"bootstrap": "lerna bootstrap",
"format:staged": "pretty-quick --staged",
"postinstall": "husky install && yarn bootstrap",
"test": "lerna run test"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
"pre-commit": "npx run format:staged"
}
}
}
-12
View File
@@ -1,12 +0,0 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-syntax-dynamic-import"]
}
+1
View File
@@ -0,0 +1 @@
REACT_APP_VERSION=$npm_package_version
+12
View File
@@ -1,3 +1,5 @@
const path = require('path');
const {
addAfterLoader,
removeLoaders,
@@ -52,7 +54,17 @@ module.exports = {
if (!babelLoaderIsAdded) throwError('failed to add back babel-loader for non-application JS');
paths.appBuild = webpackConfig.output.path = path.resolve('../resources/html');
if (webpackConfig.mode === 'development') {
webpackConfig.devtool = 'eval-source-map';
}
return webpackConfig;
},
},
devServer: (devServerConfig) => {
devServerConfig.writeToDisk = true;
return devServerConfig;
},
};
+1 -1
View File
@@ -4,7 +4,7 @@ console.log(args);
const path = './src/locale/';
const langs = ['bs', 'no', 'es', 'fr', 'pt', 'ptbr', 'sv', 'tr'];
const langs = ['bs', 'no', 'es', 'fr', 'pt', 'ptbr', 'sv', 'tr', "hu"];
const defaultLang = 'en';
+27 -62
View File
@@ -2,92 +2,57 @@
"name": "npwd-nui",
"version": "0.1.0",
"repository": "https://github.com/project-error/new-phone-who-dis",
"private": false,
"private": true,
"license": "CC-BY-NC-SA-4.0",
"homepage": "/resources/html",
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-brands-svg-icons": "^5.15.1",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.11",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@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",
"emoji-mart": "^3.0.0",
"emoji-mart": "^3.0.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"fivem-nui-react-lib": "^2.2.8",
"howler": "^2.2.1",
"i18next": "^19.7.0",
"i18next": "^20.3.4",
"jsonschema": "^1.4.0",
"parse-url": "^5.0.2",
"parse-url": "^5.0.7",
"qs": "^6.9.6",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hotkeys": "^2.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"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": "4.0.3",
"recoil": "^0.3.1"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@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",
"@sentry/integrations": "^6.10.0",
"@sentry/webpack-plugin": "^1.16.0",
"@sentry/react": "^5.29.2",
"@sentry/tracing": "^5.29.2",
"@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",
"react-test-renderer": "^16.13.1",
"style-loader": "^0.23.1",
"svg-url-loader": "^2.3.2",
"terser-webpack-plugin": "^1.3.0",
"ts-loader": "^8.0.4",
"typescript": "3.9.7",
"url-loader": "^1.1.2",
"webpack-cli": "^3.3.12"
"@welldone-software/why-did-you-render": "^6.1.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
"cross-env": "^7.0.3",
"dotenv": "^10.0.0",
"ts-loader": "^8.3.0",
"typescript": "^4.3.2"
},
"scripts": {
"i18n:missing": "node --experimental-json-modules i18n.missingKeys.js",
"copy:config": "cp-cli ../config.json ./src/config.autogen.json",
"start": "craco 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}",
"test:watch": "react-scripts test --watchAll --testMatch **/src/**/*.test.{ts,js,tsx}",
"eject": "react-scripts eject"
"start": "cross-env PUBLIC_URL=/ craco start",
"watch": "cross-env REACT_APP_IN_GAME=1 craco start",
"build:release": "cross-env SENTRY_RELEASE=true craco build",
"build": "craco build",
"test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}"
},
"eslintConfig": {
"extends": "react-app"
+96
View File
@@ -0,0 +1,96 @@
customElements.define(
'x-frame-bypass',
class extends HTMLIFrameElement {
static get observedAttributes() {
return ['src'];
}
constructor() {
super();
}
attributeChangedCallback() {
this.load(this.src);
}
connectedCallback() {
this.sandbox =
'' + this.sandbox ||
'allow-forms allow-modals allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation-by-user-activation'; // all except allow-top-navigation
}
load(url, options) {
if (!url || !url.startsWith('http'))
throw new Error(`Unable to load src ${url} does not start with http(s)://`);
this.srcdoc = `<html>
<head>
<style>
.loader {
position: absolute;
top: calc(50% - 25px);
left: calc(50% - 25px);
width: 50px;
height: 50px;
background-color: #333;
border-radius: 50%;
animation: loader 1s infinite ease-in-out;
}
@keyframes loader {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="loader"></div>
</body>
</html>`;
this.fetchProxy(url, options, 0)
.then((res) => res.text())
.then((data) => {
if (data)
this.srcdoc = data.replace(
/<head([^>]*)>/i,
`<head$1>
<base href="${url}">
<script>
// X-Frame-Bypass navigation event handlers
document.addEventListener('click', e => {
if (frameElement && document.activeElement && document.activeElement.href) {
e.preventDefault()
frameElement.load(document.activeElement.href)
}
})
document.addEventListener('submit', e => {
if (frameElement && document.activeElement && document.activeElement.form && document.activeElement.form.action) {
e.preventDefault()
if (document.activeElement.form.method === 'post')
frameElement.load(document.activeElement.form.action, {method: 'post', body: new FormData(document.activeElement.form)})
else
frameElement.load(document.activeElement.form.action + '?' + new URLSearchParams(new FormData(document.activeElement.form)))
}
})
</script>`,
);
})
.catch((e) => console.error('Unable to load proxy iframe service', e));
}
fetchProxy(url, options, i) {
const proxies = (options || {}).proxies || [
'https://cors-anywhere.herokuapp.com/',
'https://api.codetabs.com/v1/proxy/?quest=',
];
return fetch(proxies[i] + url, options)
.then((res) => {
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res;
})
.catch((error) => {
if (i === proxies.length - 1) throw error;
return this.fetchProxy(url, options, i + 1);
});
}
},
{ extends: 'iframe' },
);
+2
View File
@@ -8,6 +8,8 @@
/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Enable experimental proxy custom iframe webcomp -->
<!-- <script type="module" src="./iframe.webcomp.js"></script>-->
<title>Project Error - New Phone Who Dis</title>
</head>
<body>
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.
+2 -2
View File
@@ -1,12 +1,12 @@
import React from 'react';
import { RecoilRoot } from 'recoil';
import { shallow } from 'enzyme';
import Phone from './Phone';
import { PhoneProviders } from './PhoneProviders';
it('renders Phone', () => {
shallow(
<RecoilRoot>
<Phone />
<PhoneProviders />
</RecoilRoot>,
);
});
+43 -80
View File
@@ -4,34 +4,33 @@ import './i18n';
import { Route } from 'react-router-dom';
import { CallModal } from './os/call/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 { NotificationBar } from './os/notifications/components/NotificationBar';
import { Navigation } from './os/navigation-bar/components/Navigation';
import { useNuiService } from './os/nui-events/hooks/useNuiService';
import { useSimcardService } from './os/simcard/hooks/useSimcardService';
import { usePhoneService } from './os/phone/hooks/usePhoneService';
import { useApps } from './os/apps/hooks/useApps';
import { useContactsService } from './apps/contacts/hooks/useContactsService';
import { useTwitterService } from './apps/twitter/hooks/useTwitterService';
import { useSelloutService } from './apps/sellout/hooks/useSelloutService';
import { useMarketplaceService } from './apps/marketplace/hooks/useMarketplaceService';
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 { usePhone } from './os/phone/hooks/usePhone';
import { useTranslation } from 'react-i18next';
import { useSnackbar } from './ui/hooks/useSnackbar';
import { PhoneEvents } from '../../typings/phone';
import { useKeyboardService } from './os/keyboard/hooks/useKeyboardService';
import PhoneWrapper from './PhoneWrapper';
import dayjs from 'dayjs';
import DefaultConfig from '../../config.json';
import { TopLevelErrorComponent } from './ui/components/TopLevelErrorComponent';
import { useConfig } from './os/phone/hooks/useConfig';
function Phone() {
const { t, i18n } = useTranslation();
@@ -60,102 +59,66 @@ function Phone() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useNuiService();
useConfig();
useKeyboardService();
usePhoneService();
useSimcardService();
useContactsService();
useTwitterService();
useSelloutService();
useMarketplaceService();
useBankService();
useMessagesService();
useNotesService();
usePhotoService();
/*usePhotoService();*/
useCallService();
useDialService();
const { modal: callModal } = useCallModal();
const { bottom, visibility } = usePhoneVisibility();
const { isPhoneReady } = usePhone();
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,
}}
>
<div
className="PhoneFrame"
style={{
backgroundImage: `url(media/frames/${settings.frame.value})`,
}}
/>
<div
id="phone"
className="PhoneScreen"
style={{
backgroundImage: `url(media/backgrounds/${settings.wallpaper.value})`,
}}
>
{isPhoneReady ? (
<>
<NotificationBar />
<div className="PhoneAppContainer">
<>
<Route exact path="/" component={HomeApp} />
{callModal && <Route exact path="/call" component={CallModal} />}
{apps.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>
<TopLevelErrorComponent>
<WindowSnackbar />
<PhoneWrapper>
<NotificationBar />
<div className="PhoneAppContainer">
<>
<Route exact path="/" component={HomeApp} />
{callModal && <Route exact path="/call" component={CallModal} />}
{apps.map((App) => (
<App.Route key={App.id} />
))}
</>
<NotificationAlert />
<PhoneSnackbar />
</div>
</div>
</Slide>
<Navigation />
</PhoneWrapper>
</TopLevelErrorComponent>
</div>
);
}
export default Phone;
InjectDebugData([
InjectDebugData<any>([
{
app: 'PHONE',
method: 'setVisibility',
method: PhoneEvents.SET_VISIBILITY,
data: true,
},
{
app: 'PHONE',
method: 'setPhoneReady',
method: PhoneEvents.SET_PHONE_READY,
data: true,
},
{
app: 'PHONE',
method: PhoneEvents.SET_TIME,
data: dayjs().format('hh:mm'),
},
{
app: 'PHONE',
method: PhoneEvents.SET_CONFIG,
data: DefaultConfig,
},
]);
@@ -4,19 +4,22 @@ import { NotificationsProvider } from './os/notifications/providers/Notification
import { usePhoneTheme } from './os/phone/hooks/usePhoneTheme';
import SnackbarProvider from './ui/providers/SnackbarProvider';
import Phone from './Phone';
import { NuiProvider } from 'fivem-nui-react-lib';
import { SoundProvider } from './os/sound/providers/SoundProvider';
export const PhoneContainer = () => {
export const PhoneProviders = () => {
const currentTheme = usePhoneTheme();
return (
<ThemeProvider theme={currentTheme}>
<SoundProvider>
<NotificationsProvider>
<SnackbarProvider>
<Phone />
</SnackbarProvider>
</NotificationsProvider>
</SoundProvider>
</ThemeProvider>
<NuiProvider resource="npwd">
<ThemeProvider theme={currentTheme}>
<SoundProvider>
<NotificationsProvider>
<SnackbarProvider>
<Phone />
</SnackbarProvider>
</NotificationsProvider>
</SoundProvider>
</ThemeProvider>
</NuiProvider>
);
};
+46
View File
@@ -0,0 +1,46 @@
import React from 'react';
import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper';
import { useSettings } from './apps/settings/hooks/useSettings';
import { usePhoneVisibility } from './os/phone/hooks/usePhoneVisibility';
import { Slide } from '@material-ui/core';
const PhoneWrapper: React.FC = ({ children }) => {
const [settings] = useSettings();
const { bottom, visibility } = usePhoneVisibility();
return (
<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,
}}
>
<div
className="PhoneFrame"
style={{
backgroundImage: `url(media/frames/${settings.frame.value})`,
}}
/>
<div
id="phone"
className="PhoneScreen"
style={{
backgroundImage: !isDefaultWallpaper(settings.wallpaper.value)
? `url(${settings.wallpaper.value})`
: `url(media/backgrounds/${settings.wallpaper.value})`,
}}
>
{children}
</div>
</div>
</div>
</Slide>
);
};
export default PhoneWrapper;
@@ -3,8 +3,7 @@ import React, { useState } from 'react';
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 { Home, List, Payment } from '@material-ui/icons';
const useStyles = makeStyles((theme) => ({
root: {
@@ -30,21 +29,9 @@ export const NavigationBar = () => {
showLabels
className={classes.root}
>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faHome} />}
to="/bank"
/>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faMoneyCheck} />}
to="/bank/account"
/>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faList} />}
to="/bank/transactions"
/>
<BottomNavigationAction component={Link} icon={<Home />} to="/bank" />
<BottomNavigationAction component={Link} icon={<Payment />} to="/bank/account" />
<BottomNavigationAction component={Link} icon={<List />} to="/bank/transactions" />
</BottomNavigation>
);
};
@@ -49,16 +49,6 @@ export const TransactionList = () => {
</div>
</div>
))}
<TablePagination
rowsPerPageOptions={[3, 5]}
className={classes.pagination}
component="div"
count={transactionList.length}
rowsPerPage={rowsPerPage}
page={page}
onChangePage={handleChangePage}
onChangeRowsPerPage={handleChangeRowsPerPage}
/>
</div>
</div>
);
@@ -1,11 +1,10 @@
import React, { useState } from 'react';
import Modal from '../../../../ui/components/Modal';
import { Button, List, ListItem, TextField, makeStyles } from '@material-ui/core';
import Nui from '../../../../os/nui-events/utils/Nui';
import { Button, List, ListItem, makeStyles } from '@material-ui/core';
import { useBankModal } from '../../hooks/useBankModal';
import { BankEvents } from '../../../../../../typings/bank';
import { useNuiRequest } from 'fivem-nui-react-lib';
import { TextField } from '../../../../ui/components/Input';
const useStyles = makeStyles((theme) => ({
input: {
@@ -30,6 +29,7 @@ const useStyles = makeStyles((theme) => ({
}));
export const TransferModal = () => {
const Nui = useNuiRequest();
const classes = useStyles();
const [targetID, setTargetID] = useState('');
+6 -5
View File
@@ -1,4 +1,4 @@
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { useNuiEvent } from 'fivem-nui-react-lib';
import { bankState } from './state';
import { useTransactions } from './useTransactions';
import { useCredentials } from './useCredentials';
@@ -6,6 +6,7 @@ import { useSetRecoilState } from 'recoil';
import { useBankNotification } from './useBankNotification';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next';
import { BankEvents } from '../../../../../typings/bank';
export const useBankService = () => {
const setTransaction = useSetRecoilState(bankState.transactions);
@@ -21,9 +22,9 @@ export const useBankService = () => {
});
};
useNuiEvent('BANK', 'setTransaction', setTransaction);
useNuiEvent('BANK', 'setCredentials', setCredentials);
useNuiEvent('BANK', 'setAlert', handleAddAlert);
useNuiEvent('BANK', 'setNotification', setNotification);
useNuiEvent('BANK', BankEvents.SEND_TRANSFERS, setTransaction);
useNuiEvent('BANK', BankEvents.SEND_CREDENTIALS, setCredentials);
useNuiEvent('BANK', BankEvents.SEND_ALERT, handleAddAlert);
useNuiEvent('BANK', BankEvents.SEND_NOTIFICATION, setNotification);
return { useTransactions, useCredentials, useBankNotification };
};
@@ -0,0 +1,108 @@
import { AppWrapper } from '../../../ui/components';
import React, { Reducer, useReducer, useRef } from 'react';
import { AppContent } from '../../../ui/components/AppContent';
import { Box, makeStyles } from '@material-ui/core';
import { BrowserURLBar } from './BrowserURLBar';
import { promiseTimeout } from '../../../utils/promiseTimeout';
import { usePhoneConfig } from '../../../config/hooks/usePhoneConfig';
const useStyles = makeStyles(() => ({
iframe: {
height: '100%',
width: '100%',
zoom: 0.5,
border: 'none',
},
root: {
height: '100%',
display: 'flex',
flexDirection: 'column',
},
}));
interface BrowserState {
browserUrl: string;
browserHistory: string[];
}
interface ReducerAction {
payload: any;
type: ReducerActionsType;
}
enum ReducerActionsType {
SET_URL,
ADD_HISTORY,
RELOAD,
}
const browserReducer: Reducer<BrowserState, ReducerAction> = (state, action) => {
switch (action.type) {
case ReducerActionsType.ADD_HISTORY:
if (action.payload === 'about:blank') return state;
return { ...state, browserHistory: state.browserHistory.concat(action.payload) };
case ReducerActionsType.SET_URL:
return { ...state, browserUrl: action.payload };
default:
throw new Error('Invalid reducer action type');
}
};
export const BrowserApp: React.FC = () => {
const classes = useStyles();
const [{ appSettings }] = usePhoneConfig();
const [browserState, dispatch] = useReducer(browserReducer, {
browserUrl: appSettings.browserHomePage,
browserHistory: [appSettings.browserHomePage],
});
const { browserHistory, browserUrl } = browserState;
const iframeRef = useRef<HTMLIFrameElement | null>(null);
const _setBrowserUrl = (newUrl: string) => {
const formattedUrl = newUrl.match(/^(http|https):\/\//) ? newUrl : 'https://' + newUrl;
dispatch({ payload: browserUrl, type: ReducerActionsType.ADD_HISTORY });
dispatch({ payload: formattedUrl, type: ReducerActionsType.SET_URL });
};
const handleGoBack = () => {
if (browserHistory.length <= 1) return;
// Get last page from history
const lastPage = browserHistory[browserHistory.length - 1];
// Bail if last page is same as current
if (lastPage === browserUrl) return;
_setBrowserUrl(lastPage);
};
const reloadPage = async () => {
const strCopy = browserUrl.slice();
dispatch({ payload: 'about:blank', type: ReducerActionsType.SET_URL });
await promiseTimeout(100);
dispatch({ payload: strCopy, type: ReducerActionsType.SET_URL });
};
return (
<AppWrapper id="browser">
<AppContent className={classes.root}>
<BrowserURLBar
browserUrl={browserUrl}
browserHasHistory={browserHistory.length > 1}
setBrowser={_setBrowserUrl}
goBack={handleGoBack}
reloadPage={reloadPage}
/>
<Box flexGrow={1}>
<iframe
is="x-frame-bypass"
src={browserUrl}
// @ts-ignore
className={classes.iframe}
title="npwd-browser"
ref={iframeRef}
/>
</Box>
</AppContent>
</AppWrapper>
);
};
@@ -0,0 +1,92 @@
import React, { FocusEventHandler, useRef, useState } from 'react';
import { makeStyles, Theme, Box, IconButton } from '@material-ui/core';
import { Cached, KeyboardArrowLeft } from '@material-ui/icons';
import { InputBase } from '../../../ui/components/Input';
const useStyles = makeStyles((theme: Theme) => ({
urlInput: {
borderRadius: 18,
borderWidth: 1,
borderStyle: 'solid',
paddingRight: 10,
paddingLeft: 10,
marginLeft: 5,
borderColor: '#787878FF',
color: '#909090',
transition: 'color 0.1s ease',
},
urlInputFocused: {
color: '#fff',
},
root: {},
}));
interface BrowserControlsProps {
setBrowser: (url: string) => void;
browserUrl: string;
reloadPage: () => void;
browserHasHistory: boolean;
goBack: () => void;
}
export const BrowserURLBar: React.FC<BrowserControlsProps> = ({
goBack,
reloadPage,
browserHasHistory,
browserUrl,
setBrowser,
}) => {
const classes = useStyles();
const inputRef = useRef<HTMLInputElement>(null);
const [inputState, setInputState] = useState('');
const [isFocused, setFocus] = useState(false);
const handleFocus: FocusEventHandler = (e) => {
setInputState(browserUrl);
setFocus(true);
};
const handleFocusOut: FocusEventHandler = (e) => {
setFocus(false);
setInputState(browserUrl);
};
const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
setInputState(e.target.value);
};
const onEnter: React.KeyboardEventHandler<HTMLInputElement> = (e) => {
if ((e as any).code !== 'Enter') return;
setBrowser(inputState);
e.currentTarget.blur();
};
const styledUrl = browserUrl.replace(/(^\w+:|^)\/\//, '');
const transformedUrl = isFocused ? inputState : styledUrl;
return (
<Box display="flex" py={1} className={classes.root} px={1}>
<IconButton size="small" onClick={() => reloadPage()}>
<Cached />
</IconButton>
{browserHasHistory && (
<IconButton size="small" onClick={() => goBack()}>
<KeyboardArrowLeft />
</IconButton>
)}
<InputBase
className={classes.urlInput}
ref={inputRef}
fullWidth
onChange={handleChange}
onKeyDown={onEnter}
value={transformedUrl}
classes={{ focused: classes.urlInputFocused }}
onFocus={handleFocus}
spellCheck={false}
onBlur={handleFocusOut}
/>
</Box>
);
};
+11 -28
View File
@@ -3,37 +3,20 @@ import { AppWrapper } from '../../../ui/components';
import { AppContent } from '../../../ui/components/AppContent';
import { GalleryGrid } from './grid/GalleryGrid';
import { GalleryModal } from './modal/GalleryModal';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { Route, Switch } from 'react-router-dom';
import { LoadingSpinner } from '../../../ui/components/LoadingSpinner';
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 = () => {
return (
<AppWrapper id="camera-app">
<AppContent>
<Switch>
const CameraApp: React.FC = () => (
<AppWrapper id="camera-app">
<AppContent>
<Switch>
<React.Suspense fallback={<LoadingSpinner />}>
<Route path="/camera" exact component={GalleryGrid} />
<Route path="/camera/image" exact component={GalleryModal} />
</Switch>
</AppContent>
</AppWrapper>
);
};
</React.Suspense>
</Switch>
</AppContent>
</AppWrapper>
);
export default CameraApp;
@@ -1,37 +1,55 @@
import React from 'react';
import { Box, Button } from '@material-ui/core';
import React, { useState } from 'react';
import { Box, Button, CircularProgress } 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 { fetchNui } from '../../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../../typings/common';
import { GalleryPhoto, PhotoEvents } from '../../../../../../typings/photo';
import { usePhotoActions } from '../../hooks/usePhotoActions';
import { usePhotosValue } from '../../hooks/state';
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next';
export const GalleryGrid = () => {
const classes = useStyles();
const history = useHistory();
const query = useQueryParams();
const { addAlert } = useSnackbar();
const { t } = useTranslation();
const photos = usePhotosValue();
const { takePhoto } = usePhotoActions();
const [isLoading, setIsLoading] = useState<boolean>(false);
const referal = query.referal ? decodeURIComponent(query.referal) : '/camera/image';
const photos = usePhotos();
const handleCamera = () => {
Nui.send(PhotoEvents.TAKE_PHOTO, {});
};
const handlePhotoOpen = (photo) => {
history.push(addQueryToLocation(getLocationFromUrl(referal), 'image', photo.image));
};
const handleTakePhoto = () => {
setIsLoading(true);
fetchNui<ServerPromiseResp<GalleryPhoto>>(PhotoEvents.TAKE_PHOTO).then((serverResp) => {
if (serverResp.status !== 'ok') {
return addAlert({
message: t('APPS_CAMERA_FAILED_TO_TAKE_PHOTO'),
type: 'error',
});
}
takePhoto(serverResp.data);
setIsLoading(false);
});
};
if (!photos)
return (
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
<Box>
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
<Button onClick={takePhoto} style={{ borderRadius: 0 }} className={classes.photo}>
<AddIcon fontSize="large" />
</Button>
</Box>
@@ -42,8 +60,13 @@ export const GalleryGrid = () => {
<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" />
<Button
disabled={isLoading}
onClick={handleTakePhoto}
style={{ borderRadius: 0 }}
className={classes.photo}
>
{!isLoading ? <AddIcon fontSize="large" /> : <CircularProgress />}
</Button>
</Box>
{photos.map((photo) => (
@@ -4,23 +4,30 @@ 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 { ShareModal } from './ShareModal';
import { PhotoEvents } from '../../../../../../typings/photo';
import { GalleryPhoto, PhotoEvents } from '../../../../../../typings/photo';
import { usePhotoActions } from '../../hooks/usePhotoActions';
import { fetchNui } from '../../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../../typings/common';
import { useTranslation } from 'react-i18next';
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
export const GalleryModal = () => {
const [shareOpen, setShareOpen] = useState(null);
const classes = useStyles();
const history = useHistory();
const query = useQueryParams();
const { deletePhoto } = usePhotoActions();
const { addAlert } = useSnackbar();
const { t } = useTranslation();
const referal = query.referal || '/camera';
const [shareOpen, setShareOpen] = useState(null);
const meta: ICameraPhoto = useMemo(
() => ({ id: query.id as string, image: query.image as string }),
const meta: GalleryPhoto = useMemo(
() => ({ id: parseInt(query.id), image: query.image as string }),
[query],
);
@@ -29,10 +36,17 @@ export const GalleryModal = () => {
};
const handleDeletePhoto = () => {
Nui.send(PhotoEvents.DELETE_PHOTO, {
fetchNui<ServerPromiseResp<GalleryPhoto>>(PhotoEvents.DELETE_PHOTO, {
image: meta.image,
}).then((serverResp) => {
if (serverResp.status !== 'ok') {
return addAlert({ message: t('APPS_CAMERA_FAILED_TO_DELETE_PHOTO'), type: 'error' });
}
deletePhoto(meta.image);
history.push(referal);
});
history.push(referal);
};
const handleSharePhoto = useCallback(() => {
@@ -5,11 +5,11 @@ import MessageIcon from '@material-ui/icons/Message';
import { setClipboard } from '../../../../os/phone/hooks/useClipboard';
import useStyles from './modal.styles';
import { ICameraPhoto } from '../../hooks/usePhotos';
import { useHistory } from 'react-router-dom';
import { GalleryPhoto } from '../../../../../../typings/photo';
interface IShareModalProps {
meta: ICameraPhoto;
meta: GalleryPhoto;
referal: string;
onClose(): void;
}
+28 -3
View File
@@ -1,8 +1,33 @@
import { atom } from 'recoil';
import { atom, selector, useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { ServerPromiseResp } from '../../../../../typings/common';
import { GalleryPhoto, PhotoEvents } from '../../../../../typings/photo';
import { fetchNui } from '../../../utils/fetchNui';
import LogDebugEvent from '../../../os/debug/LogDebugEvents';
import { isEnvBrowser } from '../../../utils/misc';
import { MockPhotoData } from '../utils/constants';
export const photoState = {
photos: atom({
photos: atom<GalleryPhoto[]>({
key: 'galleryPhotos',
default: null,
default: selector({
key: 'defaultGalleryPhotos',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<GalleryPhoto[]>>(PhotoEvents.FETCH_PHOTOS);
LogDebugEvent({ action: 'PhotosFetched', data: resp.data });
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return MockPhotoData;
}
console.error(e);
return [];
}
},
}),
}),
};
export const useSetPhotos = () => useSetRecoilState(photoState.photos);
export const usePhotos = () => useRecoilState(photoState.photos);
export const usePhotosValue = () => useRecoilValue(photoState.photos);
+61
View File
@@ -0,0 +1,61 @@
import { useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { SetterOrUpdater, useRecoilState } from 'recoil';
import { GalleryPhoto, PhotoEvents } from '../../../../../typings/photo';
import { useNuiEvent, useNuiCallback } from 'fivem-nui-react-lib/';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
import { photoState } from './state';
interface IUseCamera {
photos: GalleryPhoto[];
setPhotos: SetterOrUpdater<GalleryPhoto[]>;
takePhoto: () => void;
isLoading: boolean;
}
export const useCamera = (): IUseCamera => {
const { t } = useTranslation();
const { addAlert } = useSnackbar();
const [photos, setPhotos] = useRecoilState<GalleryPhoto[]>(photoState.photos);
const [isUploading, setUploading] = useState(false);
const onPhotoSuccess = useCallback(
(photo) => {
setUploading(false);
if (!photo?.image) return;
setPhotos((curr) => [photo, ...curr]);
},
[setPhotos],
);
const onPhotoError = useCallback(
(i18nKey) => {
setUploading(false);
addAlert({ type: 'error', message: t(i18nKey) });
},
[addAlert, t],
);
const [_takePhoto] = useNuiCallback<void, GalleryPhoto>(
'CAMERA',
PhotoEvents.TAKE_PHOTO,
onPhotoSuccess,
onPhotoError,
);
useNuiEvent('CAMERA', PhotoEvents.UPLOAD_PHOTO, () => setUploading(true));
const takePhoto = () => {
// Timeout at 1 minute
_takePhoto(undefined, { timeout: 60000 });
};
return {
photos,
setPhotos,
takePhoto,
isLoading: isUploading,
};
};
@@ -0,0 +1,22 @@
import { useSetPhotos } from './state';
import { useCallback } from 'react';
export const usePhotoActions = () => {
const setPhotos = useSetPhotos();
const takePhoto = useCallback(
(photo) => {
setPhotos((curPhotos) => [photo, ...curPhotos]);
},
[setPhotos],
);
const deletePhoto = useCallback(
(image: string) => {
setPhotos((curPhotos) => [...curPhotos].filter((meta) => meta.image !== image));
},
[setPhotos],
);
return { takePhoto, deletePhoto };
};
@@ -1,8 +0,0 @@
import { useSetRecoilState } from 'recoil';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { photoState } from './state';
export const usePhotoService = () => {
const setPhotos = useSetRecoilState(photoState.photos);
useNuiEvent('CAMERA', 'setPhotos', setPhotos);
};
-11
View File
@@ -1,11 +0,0 @@
import { useRecoilValue } from 'recoil';
import { photoState } from './state';
export interface ICameraPhoto {
id: string;
image: string;
}
export const usePhotos = (): ICameraPhoto[] | null => {
return useRecoilValue<ICameraPhoto[] | null>(photoState.photos);
};
+10
View File
@@ -0,0 +1,10 @@
export const MockPhotoData = [
{
id: 1,
image: 'https://beta.iodine.gg/noDcb.jpeg',
},
{
id: 2,
image: 'https://beta.iodine.gg/teUcY.jpeg',
},
];
@@ -3,55 +3,47 @@ import { AppWrapper } from '../../../ui/components';
import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from '../../../ui/components/AppContent';
import { useApp } from '../../../os/apps/hooks/useApps';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { Route } from 'react-router-dom';
import ContactsInfoPage from './views/ContactInfo';
import { ContactPage } from './views/ContactsPage';
import { ContactsThemeProvider } from '../providers/ContactsThemeProvider';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import Fab from '@material-ui/core/Fab';
import { useHistory } from 'react-router';
import { makeStyles, Theme } from '@material-ui/core/styles';
import { LoadingSpinner } from '../../../ui/components/LoadingSpinner';
const useStyles = makeStyles((theme: Theme) => ({
absolute: {
position: 'absolute',
right: theme.spacing(3),
bottom: theme.spacing(2),
},
}));
export const ContactsApp = () => {
const contacts = useApp('CONTACTS');
const history = useHistory();
const classes = useStyles();
return (
<ContactsThemeProvider>
<AppWrapper id="contact-app">
<AppTitle app={contacts} />
<AppContent>
<Route path="/contacts/" exact component={ContactPage} />
<Route path="/contacts/:id" exact component={ContactsInfoPage} />
<React.Suspense fallback={<LoadingSpinner />}>
<Route path="/contacts/" exact component={ContactPage} />
<Route path="/contacts/:id" exact component={ContactsInfoPage} />
</React.Suspense>
</AppContent>
<Fab
color="primary"
onClick={() => history.push('/contacts/-1')}
className={classes.absolute}
>
<PersonAddIcon />
</Fab>
</AppWrapper>
</ContactsThemeProvider>
);
};
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,22 +1,19 @@
import React from 'react';
import ListItemText from '@material-ui/core/ListItemText';
import { Button, ListItemAvatar, Avatar as MuiAvatar, List, ListItem } from '@material-ui/core';
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 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 { useFilteredContacts } from '../../hooks/state';
import { useCall } from '../../../../os/call/hooks/useCall';
export const ContactList = () => {
const { filteredContacts } = useFilteredContacts();
const filteredContacts = useFilteredContacts();
const history = useHistory();
const { contacts } = useContacts();
const { initializeCall } = useCall();
const openContactInfo = (contactId: number) => {
history.push(`/contacts/${contactId}`);
@@ -28,9 +25,7 @@ export const ContactList = () => {
level: 2,
data: true,
});
Nui.send(CallEvents.INITIALIZE_CALL, {
number,
});
initializeCall(number);
};
const handleMessage = (phoneNumber: string) => {
@@ -42,38 +37,31 @@ export const ContactList = () => {
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) => (
<ListItem key={contact.id} divider>
<ListItemAvatar>
{contact.avatar ? (
<MuiAvatar src={contact.avatar} />
) : (
<MuiAvatar>{contact.display.slice(0, 1).toUpperCase()}</MuiAvatar>
)}
</ListItemAvatar>
<ListItemText primary={contact.display} secondary={contact.number} />
<Button onClick={() => startCall(contact.number)}>
<PhoneIcon />
</Button>
<Button onClick={() => handleMessage(contact.number)}>
<ChatIcon />
</Button>
<Button style={{ margin: -15 }} onClick={() => openContactInfo(contact.id)}>
<MoreVertIcon />
</Button>
</ListItem>
))}
{filteredContacts.map((contact) => (
<ListItem key={contact.id} divider>
<ListItemAvatar>
{contact.avatar ? (
<MuiAvatar src={contact.avatar} />
) : (
<MuiAvatar>{contact.display.slice(0, 1).toUpperCase()}</MuiAvatar>
)}
</ListItemAvatar>
<ListItemText primary={contact.display} secondary={contact.number} />
<Button onClick={() => startCall(contact.number)}>
<PhoneIcon />
</Button>
<Button onClick={() => handleMessage(contact.number)}>
<ChatIcon />
</Button>
<Button style={{ margin: -15 }} onClick={() => openContactInfo(contact.id)}>
<MoreVertIcon />
</Button>
</ListItem>
))}
</List>
</>
);
@@ -1,21 +1,29 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import { Box } from '@material-ui/core';
import { useTranslation } from 'react-i18next';
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
import { SearchField } from '../../../../ui/components/SearchField';
import { useDebounce } from '../../../../os/phone/hooks/useDebounce';
import { useSetContactFilterInput } from '../../hooks/state';
export const SearchContacts = () => {
const { setFilteredContacts, filteredContacts } = useFilteredContacts();
const { t } = useTranslation();
const setFilterVal = useSetContactFilterInput();
const [inputVal, setInputVal] = useState('');
const debouncedVal = useDebounce<string>(inputVal, 500);
useEffect(() => {
setFilterVal(debouncedVal);
}, [debouncedVal, setFilterVal]);
return (
<Box>
<SearchField
onChange={(e) => setFilteredContacts(e.target.value)}
onChange={(e) => setInputVal(e.target.value)}
placeholder={t('APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS')}
value={filteredContacts}
value={inputVal}
/>
</Box>
);
@@ -1,14 +1,17 @@
import React, { useEffect, useState } from 'react';
import { Avatar as MuiAvatar, Box, Button, Paper, TextField } from '@material-ui/core';
import { Avatar as MuiAvatar, Box, Button, Paper } 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 { useContactActions } from '../../hooks/useContactActions';
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import LogDebugEvent from '../../../../os/debug/LogDebugEvents';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
import { ContactEvents } from '../../../../../../typings/contact';
import { Contact, ContactEvents, ContactsDatabaseLimits } from '../../../../../../typings/contact';
import { TextField } from '../../../../ui/components/Input';
import { fetchNui } from '../../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../../typings/common';
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
interface ContactInfoRouteParams {
mode: string;
@@ -49,10 +52,11 @@ const useStyles = makeStyles({
const ContactsInfoPage = () => {
const classes = useStyles();
const history = useHistory();
const { getContact } = useContacts();
const { getContact, addContact, updateContact, deleteContact } = useContactActions();
const { addAlert } = useSnackbar();
const { id } = useParams<ContactInfoRouteParams>();
const { addNumber, referal } = useQueryParams<ContactInfoRouteQuery>({
@@ -68,6 +72,24 @@ const ContactsInfoPage = () => {
const { t } = useTranslation();
const handleNumberChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
const inputVal = e.target.value;
if (inputVal.length === ContactsDatabaseLimits.number) return;
setNumber(e.target.value);
};
const handleDisplayChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
const inputVal = e.target.value;
if (inputVal.length === ContactsDatabaseLimits.display) return;
setName(e.target.value);
};
const handleAvatarChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
const inputVal = e.target.value;
if (inputVal.length === ContactsDatabaseLimits.avatar) return;
setAvatar(e.target.value);
};
useEffect(() => {
if (addNumber) {
setNumber(addNumber);
@@ -80,12 +102,27 @@ const ContactsInfoPage = () => {
data: contact,
level: 2,
});
Nui.send(ContactEvents.ADD_CONTACT, {
fetchNui<ServerPromiseResp<Contact>>(ContactEvents.ADD_CONTACT, {
display: name,
number,
avatar,
}).then((serverResp) => {
if (serverResp.status !== 'ok') {
return addAlert({
message: t('APPS_CONTACT_ADD_FAILED'),
type: 'error',
});
}
// Sanity checks maybe?
addContact(serverResp.data);
addAlert({
message: t('APPS_CONTACT_ADD_SUCCESS'),
type: 'success',
});
history.replace(referal);
});
history.replace(referal);
};
const handleContactSave = () => {
@@ -94,13 +131,33 @@ const ContactsInfoPage = () => {
data: contact,
level: 2,
});
Nui.send(ContactEvents.UPDATE_CONTACT, {
fetchNui<ServerPromiseResp>(ContactEvents.UPDATE_CONTACT, {
id: contact.id,
display: name,
number,
avatar,
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_CONTACT_UPDATE_FAILED'),
type: 'error',
});
}
updateContact({
id: contact.id,
display: name,
number,
avatar,
});
addAlert({
message: t('APPS_CONTACT_UPDATE_SUCCESS'),
type: 'success',
});
history.goBack();
});
history.goBack();
};
const handleContactDelete = () => {
@@ -109,10 +166,20 @@ const ContactsInfoPage = () => {
data: contact,
level: 2,
});
Nui.send(ContactEvents.DELETE_CONTACT, {
id: contact.id,
fetchNui<ServerPromiseResp>(ContactEvents.DELETE_CONTACT, { id: contact.id }).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_CONTACT_DELETE_FAILED'),
type: 'error',
});
}
history.goBack();
deleteContact(contact.id);
addAlert({
message: t('APPS_CONTACT_DELETE_SUCCESS'),
type: 'error',
});
});
history.goBack();
};
return (
@@ -124,9 +191,10 @@ const ContactsInfoPage = () => {
<MuiAvatar className={classes.avatar} src={avatar} />
<TextField
autoFocus
error={name.length === ContactsDatabaseLimits.display}
className={classes.input}
value={name}
onChange={(e) => setName(e.target.value)}
onChange={handleDisplayChange}
label={t('APPS_CONTACT_FORM_NAME')}
fullWidth
inputProps={{
@@ -135,8 +203,9 @@ const ContactsInfoPage = () => {
/>
<TextField
className={classes.input}
error={number.length === ContactsDatabaseLimits.number}
value={number}
onChange={(e) => setNumber(e.target.value)}
onChange={handleNumberChange}
label={t('APPS_CONTACT_FORM_NUMBER')}
fullWidth
inputProps={{
@@ -144,11 +213,12 @@ const ContactsInfoPage = () => {
}}
/>
<TextField
error={avatar.length === ContactsDatabaseLimits.avatar}
className={classes.input}
label={t('APPS_CONTACT_FORM_AVATAR')}
fullWidth
value={avatar}
onChange={(e) => setAvatar(e.target.value)}
onChange={handleAvatarChange}
inputProps={{
className: classes.inputProps,
}}
@@ -1,37 +1,10 @@
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 (
<>
<div style={{ paddingBottom: 60 }}>
<ContactList />
<Fab
color="primary"
onClick={() => history.push('/contacts/-1')}
className={classes.absolute}
>
<PersonAddIcon />
</Fab>
</>
</div>
);
};
+49 -16
View File
@@ -1,24 +1,57 @@
import { atom } from 'recoil';
import { atom, selector, useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { Contact, ContactEvents } from '../../../../../typings/contact';
import { fetchNui } from '../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../typings/common';
import { isEnvBrowser } from '../../../utils/misc';
import LogDebugEvent from '../../../os/debug/LogDebugEvents';
import { BrowserContactsState } from '../utils/constants';
export const contactsState = {
contacts: atom({
contacts: atom<Contact[]>({
key: 'contactsList',
default: [],
default: selector({
key: 'contactsListDefault',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<Contact[]>>(ContactEvents.GET_CONTACTS);
LogDebugEvent({ action: 'ContactsFetched', data: resp.data });
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return BrowserContactsState;
}
console.error(e);
return [];
}
},
}),
}),
showModal: atom({
key: 'showModal',
default: false,
}),
filterContacts: atom({
key: 'filterContacts',
filterInput: atom<string>({
key: 'filterInput',
default: '',
}),
showContactsModal: atom({
key: 'showContactModal',
default: false,
}),
contactDetail: atom({
key: 'contactDetail',
default: null,
filteredContacts: selector({
key: 'filteredContacts',
get: ({ get }) => {
const filterInputVal: string = get(contactsState.filterInput);
const contacts: Contact[] = get(contactsState.contacts);
if (!filterInputVal) return contacts;
const regExp = new RegExp(filterInputVal, 'gi');
return contacts.filter(
(contact) => contact.display.match(regExp) || contact.number.match(regExp),
);
},
}),
};
export const useSetContacts = () => useSetRecoilState(contactsState.contacts);
export const useContacts = () => useRecoilState(contactsState.contacts);
export const useContactsValue = () => useRecoilValue(contactsState.contacts);
export const useFilteredContacts = () => useRecoilValue(contactsState.filteredContacts);
export const useContactFilterInput = () => useRecoilState(contactsState.filterInput);
export const useSetContactFilterInput = () => useSetRecoilState(contactsState.filterInput);
@@ -0,0 +1,92 @@
import { useContacts } from './state';
import { Contact } from '../../../../../typings/contact';
import { useCallback } from 'react';
interface UseContactsValue {
getDisplayByNumber: (number: string) => string;
getContactByNumber: (number: string) => Contact | null;
getContact: (id: number) => Contact | null;
getPictureByNumber: (number: string) => string | null;
deleteContact: (id: number) => void;
addContact: (contact: Contact) => void;
updateContact: (contact: Contact) => void;
}
export const useContactActions = (): UseContactsValue => {
const [contacts, setContacts] = useContacts();
const getDisplayByNumber = useCallback(
(number: string) => {
const found = contacts.find((contact) => contact.number === number);
return found ? found.display : number;
},
[contacts],
);
const getPictureByNumber = useCallback(
(number: string) => {
const found = contacts.find((contact) => contact.number === number);
return found ? found.avatar : null;
},
[contacts],
);
const getContactByNumber = useCallback(
(number: string): Contact | null => {
for (const contact of contacts) {
if (contact.number === number) return contact;
}
return null;
},
[contacts],
);
const getContact = useCallback(
(id: number): Contact | null => {
for (const contact of contacts) {
if (contact.id === id) return contact;
}
return null;
},
[contacts],
);
const deleteContact = useCallback(
(id: number): void => {
setContacts((curContacts) => [...curContacts].filter((contact) => contact.id !== id));
},
[setContacts],
);
const addContact = useCallback(
(contact: Contact) => {
setContacts((curContacts) => [...curContacts, contact]);
},
[setContacts],
);
const updateContact = useCallback(
(updatedContact: Contact) => {
setContacts((curContacts) => {
const targetContactIndex = curContacts.findIndex(
(contact) => contact.id === updatedContact.id,
);
const newContactsArray = [...curContacts];
newContactsArray[targetContactIndex] = updatedContact;
return newContactsArray;
});
},
[setContacts],
);
return {
getDisplayByNumber,
getContact,
getContactByNumber,
getPictureByNumber,
deleteContact,
updateContact,
addContact,
};
};
@@ -1,46 +0,0 @@
import { useRecoilValue } from 'recoil';
import { contactsState } from './state';
import { Contact } from '../../../../../typings/contact';
import { useCallback } from 'react';
interface IUseContacts {
contacts: Contact[];
getDisplayByNumber: (number: string) => string;
getContactByNumber: (number: string) => Contact | null;
getContact: (id: number) => Contact | null;
}
export const useContacts = (): IUseContacts => {
const contacts = useRecoilValue(contactsState.contacts);
const getDisplayByNumber = useCallback(
(number: string) => {
const found = contacts.find((contact) => contact.number === number);
return found ? found.display : number;
},
[contacts],
);
const getContactByNumber = useCallback(
(number: string): Contact | null => {
for (const contact of contacts) {
if (contact.number === number) return contact;
}
return null;
},
[contacts],
);
const getContact = useCallback(
(id: number): Contact | null => {
for (const contact of contacts) {
if (contact.id === id) return contact;
}
return null;
},
[contacts],
);
return { contacts, getDisplayByNumber, getContact, getContactByNumber };
};
@@ -1,23 +0,0 @@
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { useSetRecoilState } from 'recoil';
import { contactsState } from './state';
import { useContacts } from './useContacts';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next';
export const useContactsService = () => {
const setContacts = useSetRecoilState(contactsState.contacts);
const { addAlert } = useSnackbar();
const { t } = useTranslation();
const handleAddAlert = ({ message, type }: IAlert) => {
addAlert({
message: t(`APPS_${message}`),
type,
});
};
useNuiEvent('CONTACTS', 'setContacts', setContacts);
useNuiEvent('CONTACTS', 'setAlert', handleAddAlert);
return useContacts();
};
@@ -1,12 +0,0 @@
import { useRecoilState } from 'recoil';
import { contactsState } from './state';
interface FilterdContactsProps {
filteredContacts: string;
setFilteredContacts: (contact: any) => void;
}
export const useFilteredContacts = (): FilterdContactsProps => {
const [filteredContacts, setFilteredContacts] = useRecoilState(contactsState.filterContacts);
return { filteredContacts, setFilteredContacts };
};
-12
View File
@@ -1,12 +0,0 @@
import { useRecoilState } from 'recoil';
import { contactsState } from './state';
interface ModalProps {
showModal: boolean;
setShowModal: (show: boolean) => void;
}
export const useModal = (): ModalProps => {
const [showModal, setShowModal] = useRecoilState(contactsState.showModal);
return { showModal, setShowModal };
};
@@ -0,0 +1,24 @@
export const BrowserContactsState = [
{
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: '603-275-8373',
avatar: 'http://i.tasoagc.dev/2QYV',
},
{
id: 4,
display: 'Kidz',
number: '444-4444',
},
];
+10 -24
View File
@@ -7,14 +7,17 @@ import { useApp } from '../../../os/apps/hooks/useApps';
import { Switch, Route } from 'react-router-dom';
import DialPage from './views/DialPage';
import DialerNavBar from './DialerNavBar';
import { useDialHistory } from '../hooks/useDialHistory';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { ContactList } from '../../contacts/components/List/ContactList';
import { DialerThemeProvider } from '../providers/DialerThemeProvider';
import { Box, CircularProgress } from '@material-ui/core';
const LoadingSpinner: React.FC = () => (
<Box>
<CircularProgress />
</Box>
);
export const DialerApp = () => {
const history = useDialHistory();
const dialer = useApp('DIALER');
return (
<DialerThemeProvider>
@@ -26,7 +29,9 @@ export const DialerApp = () => {
<DialPage />
</Route>
<Route exact path="/phone">
<DialerHistory calls={history} />
<React.Suspense fallback={<LoadingSpinner />}>
<DialerHistory />
</React.Suspense>
</Route>
<Route path="/phone/contacts" component={ContactList} />
</Switch>
@@ -36,22 +41,3 @@ export const DialerApp = () => {
</DialerThemeProvider>
);
};
InjectDebugData([
{
app: 'DIALER',
method: 'setHistory',
data: [
{
id: 1,
transmitter: '636-6496',
start: 1615946292,
},
{
id: 2,
transmitter: '777-7777',
start: 1615946292,
},
],
},
]);
@@ -1,12 +1,13 @@
import React, { useContext } from 'react';
import { Box, IconButton, InputBase, Paper } from '@material-ui/core';
import { Box, IconButton, Paper } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
import PhoneIcon from '@material-ui/icons/Phone';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { DialInputCtx, IDialInputCtx } from '../context/InputContext';
import Nui from '../../../os/nui-events/utils/Nui';
import { useHistory } from 'react-router-dom';
import { CallEvents } from '../../../../../typings/call';
import { useTranslation } from 'react-i18next';
import { InputBase } from '../../../ui/components/Input';
import { useCall } from '../../../os/call/hooks/useCall';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -30,13 +31,13 @@ const useStyles = makeStyles((theme: Theme) => ({
export const DialerInput = () => {
const classes = useStyles();
const history = useHistory();
const { t } = useTranslation();
const { initializeCall } = useCall();
const { inputVal, set } = useContext<IDialInputCtx>(DialInputCtx);
const handleCall = (number: string) => {
Nui.send(CallEvents.INITIALIZE_CALL, {
number,
});
initializeCall(number);
};
const handleNewContact = (number: string) => {
@@ -46,7 +47,7 @@ export const DialerInput = () => {
return (
<Box component={Paper} className={classes.root}>
<InputBase
placeholder="Enter a number"
placeholder={t('APPS_DIALER_INPUT_PLACEHOLDER')}
className={classes.input}
value={inputVal}
onChange={(e) => set(e.target.value)}
@@ -5,6 +5,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
import PhoneIcon from '@material-ui/icons/Phone';
import PersonIcon from '@material-ui/icons/Person';
import HistoryIcon from '@material-ui/icons/History';
import { useTranslation } from 'react-i18next';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -20,6 +21,7 @@ const DialerNavBar = () => {
const classes = useStyles();
const { pathname } = useLocation();
const [page, setPage] = useState(pathname);
const { t } = useTranslation();
const handleChange = (_e, newPage) => {
setPage(newPage);
@@ -28,14 +30,14 @@ const DialerNavBar = () => {
return (
<BottomNavigation value={page} onChange={handleChange} showLabels className={classes.root}>
<BottomNavigationAction
label="History"
label={t('APPS_DIALER_NAVBAR_HISTORY')}
value="/phone"
component={NavLink}
icon={<HistoryIcon />}
to="/phone"
/>
<BottomNavigationAction
label="Dial"
label={t('APPS_DIALER_NAVBAR_DIAL')}
value="/phone/dial"
color="secondary"
component={NavLink}
@@ -43,7 +45,7 @@ const DialerNavBar = () => {
to="/phone/dial"
/>
<BottomNavigationAction
label="Contacts"
label={t('APPS_DIALER_NAVBAR_CONTACTS')}
value="/phone/contacts"
color="secondary"
component={NavLink}
@@ -5,15 +5,16 @@ import PhoneIcon from '@material-ui/icons/Phone';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { List } from '../../../../ui/components/List';
import { ListItem } from '../../../../ui/components/ListItem';
import Nui from '../../../../os/nui-events/utils/Nui';
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
import { useContacts } from '../../../contacts/hooks/useContacts';
import { CallEvents, ICall } from '../../../../../../typings/call';
import { useContactActions } from '../../../contacts/hooks/useContactActions';
import { CallHistoryItem } from '../../../../../../typings/call';
import { useTranslation } from 'react-i18next';
import { Box, IconButton, ListItemIcon, ListItemText } from '@material-ui/core';
import { useHistory } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core/styles';
import dayjs from 'dayjs';
import { useMyPhoneNumber } from '../../../../os/simcard/hooks/useMyPhoneNumber';
import { useDialHistory } from '../../hooks/useDialHistory';
import { useCall } from '../../../../os/call/hooks/useCall';
const useStyles = makeStyles((theme: Theme) => ({
callForward: {
@@ -24,20 +25,17 @@ const useStyles = makeStyles((theme: Theme) => ({
},
}));
export const DialerHistory = ({ calls }) => {
const { number: myNumber } = useSimcard();
const { getDisplayByNumber } = useContacts();
export const DialerHistory: React.FC = () => {
const myNumber = useMyPhoneNumber();
const { getDisplayByNumber } = useContactActions();
const { initializeCall } = useCall();
const calls = useDialHistory();
const classes = useStyles();
const history = useHistory();
const { t } = useTranslation();
const handleCall = (phoneNumber) => {
Nui.send(CallEvents.INITIALIZE_CALL, {
number: phoneNumber,
});
initializeCall(phoneNumber);
};
if (!calls?.length) {
@@ -55,7 +53,7 @@ export const DialerHistory = ({ calls }) => {
return (
<List disablePadding>
{calls.map((call: ICall) =>
{calls.map((call: CallHistoryItem) =>
call.transmitter === myNumber ? (
<ListItem key={call.id} divider>
<ListItemIcon>
@@ -66,15 +64,15 @@ export const DialerHistory = ({ calls }) => {
primary={getDisplayByNumber(call.receiver)}
secondary={
// TODO: Locale changes are pending #168 merge
dayjs().to(dayjs.unix(call.start))
dayjs().to(dayjs.unix(parseInt(call.start)))
}
/>
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
{getDisplayByNumber(call.transmitter) === call.transmitter && (
{getDisplayByNumber(call.receiver) === call.receiver && (
<IconButton
onClick={() =>
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
history.push(`/contacts/-1?addNumber=${call.receiver}&referal=/phone/contacts`)
}
>
<PersonAddIcon />
@@ -91,7 +89,7 @@ export const DialerHistory = ({ calls }) => {
primary={getDisplayByNumber(call.transmitter)}
secondary={
// TODO: Locale changes are pending #168 merge
dayjs().to(dayjs.unix(call.start))
dayjs().to(dayjs.unix(parseInt(call.start)))
}
/>
<IconButton onClick={() => handleCall(call.transmitter)}>
+24 -3
View File
@@ -1,8 +1,29 @@
import { atom } from 'recoil';
import { atom, selector } from 'recoil';
import { CallEvents, CallHistoryItem } from '../../../../../typings/call';
import { fetchNui } from '../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../typings/common';
import LogDebugEvent from '../../../os/debug/LogDebugEvents';
import { isEnvBrowser } from '../../../utils/misc';
import { MockHistoryData } from '../utils/constants';
export const dialState = {
history: atom({
history: atom<CallHistoryItem[]>({
key: 'dialHistory',
default: [],
default: selector({
key: 'dialHistoryDefault',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<CallHistoryItem[]>>(CallEvents.FETCH_CALLS);
LogDebugEvent({ action: 'ContactsFetched', data: resp.data });
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return MockHistoryData;
}
console.error(e);
return [];
}
},
}),
}),
};
@@ -1,7 +1,4 @@
import { useRecoilValue } from 'recoil';
import { ICall } from '../../../../../typings/call';
import { dialState } from './state';
export const useDialHistory = () => {
return useRecoilValue<ICall[]>(dialState.history);
};
export const useDialHistory = () => useRecoilValue(dialState.history);
+15 -5
View File
@@ -1,8 +1,18 @@
import { useSetRecoilState } from 'recoil';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { dialState } from './state';
import { useNuiEvent } from 'fivem-nui-react-lib';
import { CallEvents } from '../../../../../typings/call';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next';
export const useDialService = () => {
const setHistory = useSetRecoilState(dialState.history);
useNuiEvent('DIALER', 'setHistory', setHistory);
const { addAlert } = useSnackbar();
const { t } = useTranslation();
const handleAddAlert = ({ message, type }: IAlert) => {
addAlert({
message: t(`APPS_${message}`),
type,
});
};
useNuiEvent('DIALER', CallEvents.SEND_ALERT, handleAddAlert);
};
+22
View File
@@ -0,0 +1,22 @@
import { CallHistoryItem } from '../../../../../typings/call';
export const MockHistoryData: CallHistoryItem[] = [
{
id: 1,
identifier: 'ca839e8c-ef9d-40bd-b6a3-d531ee58149f',
transmitter: '704-1549',
receiver: '704-1549',
is_accepted: true,
start: '1615939174',
end: null,
},
{
id: 2,
identifier: 'b8080a50-ad30-4ee9-84cb-00688e2bf167',
transmitter: '704-1549',
receiver: '704-1549',
is_accepted: false,
start: '1615939850',
end: null,
},
];
@@ -1,4 +1,4 @@
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { useNuiEvent } from 'fivem-nui-react-lib';
import { useSetRecoilState } from 'recoil';
import { exampleState } from './state';
import { useExample } from './useExample';
@@ -0,0 +1,29 @@
import React from 'react';
import { AppWrapper } from '../../../ui/components';
import { AppContent } from '../../../ui/components/AppContent';
import { MarketplaceListContainer } from './MarketplaceList/MarketplaceListContainer';
import { NavigationBar } from './navigation/NavigationBar';
import { Switch, Route } from 'react-router-dom';
import { ListingFormContainer } from './form/ListingFormContainer';
import { MarketplaceThemeProvider } from '../providers/MarketplaceThemeProvider';
import { AppTitle } from '../../../ui/components/AppTitle';
import { useApp } from '../../../os/apps/hooks/useApps';
export const MarketplaceApp = () => {
const marketplaceApp = useApp('MARKETPLACE');
return (
<MarketplaceThemeProvider>
<AppWrapper id="marketplace-app">
<AppTitle app={marketplaceApp} />
<AppContent>
<Switch>
<Route path="/marketplace" exact component={MarketplaceListContainer} />
<Route path="/marketplace/new" component={ListingFormContainer} />
</Switch>
</AppContent>
<NavigationBar />
</AppWrapper>
</MarketplaceThemeProvider>
);
};
@@ -2,15 +2,17 @@ import { Box, Tooltip, Button } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
import React from 'react';
import { MarketplaceEvents, MarketplaceListing } from '../../../../../../typings/marketplace';
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
import DeleteIcon from '@material-ui/icons/Delete';
import ReportIcon from '@material-ui/icons/Report';
import ChatIcon from '@material-ui/icons/Chat';
import PhoneIcon from '@material-ui/icons/Phone';
import Nui from '../../../../os/nui-events/utils/Nui';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router';
import { CallEvents } from '../../../../../../typings/call';
import { fetchNui } from '../../../../utils/fetchNui';
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
import { ServerPromiseResp } from '../../../../../../typings/common';
import { useMyPhoneNumber } from '../../../../os/simcard/hooks/useMyPhoneNumber';
import { useCall } from '../../../../os/call/hooks/useCall';
const useStyles = makeStyles((theme: Theme) => ({
icon: {
@@ -18,26 +20,52 @@ const useStyles = makeStyles((theme: Theme) => ({
},
}));
export const ListingActions = ({ listing }: { listing: MarketplaceListing }) => {
export const ListingActions: React.FC<MarketplaceListing> = ({ children, ...listing }) => {
const classes = useStyles();
const { number: myNumber } = useSimcard();
const myNumber = useMyPhoneNumber();
const { t } = useTranslation();
const history = useHistory();
const { initializeCall } = useCall();
const { addAlert } = useSnackbar();
const handleDeleteListing = () => {
Nui.send(MarketplaceEvents.DELETE_LISTING, {
fetchNui<ServerPromiseResp>(MarketplaceEvents.DELETE_LISTING, {
id: listing.id,
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_MARKETPLACE_DELETE_LISTING_FAILED'),
type: 'error',
});
}
addAlert({
message: t('APPS_MARKETPLACE_DELETE_LISTING_SUCCESS'),
type: 'success',
});
});
};
const handleReportListing = () => {
Nui.send(MarketplaceEvents.REPORT_LISTING, listing);
fetchNui<ServerPromiseResp>(MarketplaceEvents.REPORT_LISTING, {
listingId: listing.id,
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_MARKETPLACE_REPORT_LISTING_FAILED'),
type: 'error',
});
}
addAlert({
message: t('APPS_MARKETPLACE_REPORT_LISTING_SUCCESS'),
type: 'success',
});
});
};
const handleCall = () => {
Nui.send(CallEvents.INITIALIZE_CALL, {
number: listing.number,
});
initializeCall(listing.number);
};
const handleMessage = () => {
@@ -45,9 +73,9 @@ export const ListingActions = ({ listing }: { listing: MarketplaceListing }) =>
};
return (
<Box flex justifyContent="space-between" alignItems="center">
<Box justifyContent="space-between" alignItems="center">
<div style={{ float: 'left' }}>
{listing.number !== myNumber ? (
{listing.number !== myNumber && (
<>
<Tooltip title={t('GENERIC_MESSAGE')}>
<Button onClick={handleMessage}>
@@ -60,7 +88,7 @@ export const ListingActions = ({ listing }: { listing: MarketplaceListing }) =>
</Button>
</Tooltip>
</>
) : null}
)}
</div>
<div style={{ float: 'right' }}>
@@ -31,9 +31,17 @@ const useStyles = makeStyles((theme) => ({
background: theme.palette.background.default,
marginBottom: 20,
},
listingContent: {
padding: 10,
minWidth: 100,
maxWidth: '100%',
width: '100%',
overflowWrap: 'break-word',
wordWrap: 'break-word',
},
}));
export const SelloutItem = (listing: MarketplaceListing) => {
export const MarketplaceItem: React.FC<MarketplaceListing> = ({ children, ...listing }) => {
const classes = useStyles();
return (
@@ -62,10 +70,10 @@ export const SelloutItem = (listing: MarketplaceListing) => {
</Typography>
)}
<Typography variant="h6" style={{ padding: 10 }}>
<Typography variant="body1" className={classes.listingContent}>
{listing.description}
</Typography>
<ListingActions listing={listing} />
<ListingActions {...listing} />
</Paper>
</div>
</ListItem>
@@ -0,0 +1,16 @@
import React from 'react';
import { List } from '../../../../ui/components/List';
import { useListingValue } from '../../hooks/state';
import { MarketplaceItem } from './MarketplaceItem';
export const MarketplaceList: React.FC = () => {
const listings = useListingValue();
return (
<List>
{listings.map((listing) => (
<MarketplaceItem key={listing.id} {...listing} />
))}
</List>
);
};
@@ -0,0 +1,11 @@
import React from 'react';
import { MarketplaceList } from './MarketplaceList';
import { LoadingSpinner } from '../../../../ui/components/LoadingSpinner';
export const MarketplaceListContainer: React.FC = () => {
return (
<React.Suspense fallback={<LoadingSpinner />}>
<MarketplaceList />
</React.Suspense>
);
};
@@ -0,0 +1,160 @@
import React, { useEffect, useState, useCallback } from 'react';
import { makeStyles, Button, Box } from '@material-ui/core';
import { MarketplaceEvents, MarketplaceListing } from '../../../../../../typings/marketplace';
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next';
import ImageIcon from '@material-ui/icons/Image';
import { useHistory, useLocation } from 'react-router-dom';
import qs from 'qs';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation';
import { TextField } from '../../../../ui/components/Input';
import { fetchNui } from '../../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../../typings/common';
const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
margin: 'auto',
textAlign: 'center',
},
input: {
marginBottom: 25,
},
textFieldInput: {
fontSize: 22,
},
multilineFieldInput: {
fontSize: 20,
},
postButton: {
display: 'block',
margin: 'auto',
background: theme.palette.primary.main,
width: '80%',
fontSize: 20,
},
}));
export const ListingForm = () => {
const classes = useStyles();
const { t } = useTranslation();
const { addAlert } = useSnackbar();
const history = useHistory();
const { pathname, search } = useLocation();
const query = useQueryParams();
const [title, setTitle] = useState('');
const [url, setUrl] = useState('');
const [description, setDescription] = useState('');
const addListing = () => {
if (title !== '' && description !== '') {
fetchNui<ServerPromiseResp<MarketplaceListing[]>>(MarketplaceEvents.ADD_LISTING, {
title,
description,
url,
}).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: t('APPS_MARKETPLACE_CREATE_LISTING_FAILED'),
type: 'error',
});
}
addAlert({
message: t('APPS_MARKETPLACE_CREATE_LISTING_SUCCESS'),
type: 'success',
});
history.push('/marketplace');
});
} else {
addAlert({
message: t('APPS_MARKETPLACE_REQUIRED_FIELDS'),
type: 'error',
});
}
};
/*const handleChooseImage = () => {
history.push(`/camera?${qs.stringify({
referal: encodeURIComponent(pathname + search),
})}`)
}*/
const handleChooseImage = useCallback(() => {
history.push(
`/camera?${qs.stringify({
referal: encodeURIComponent(pathname + search),
})}`,
);
}, [history, pathname, search]);
useEffect(() => {
if (!query?.image) return;
setUrl(query?.image);
history.replace(deleteQueryFromLocation({ pathname, search }, 'image'));
}, [query?.image, history, pathname, search]);
return (
<div className={classes.root}>
<h1>New Listing</h1>
<TextField
className={classes.input}
onChange={(e) => setTitle(e.target.value)}
label={t('GENERIC_REQUIRED')}
placeholder={t('APPS_MARKETPLACE_FORM_TITLE')}
inputProps={{
className: classes.textFieldInput,
maxLength: 25,
}}
style={{ width: '80%' }}
size="medium"
InputLabelProps={{
shrink: true,
}}
/>
<Box display="flex" alignItems="center" paddingLeft={5}>
<div>
<ImageIcon />
</div>
<div>
<Button onClick={handleChooseImage}>Choose a image</Button>
</div>
</Box>
<TextField
className={classes.input}
placeholder={t('APPS_MARKETPLACE_FORM_IMAGE')}
value={url}
onChange={(e) => setUrl(e.currentTarget.value)}
inputProps={{ className: classes.textFieldInput }}
style={{ width: '80%' }}
size="medium"
variant="outlined"
/>
<TextField
className={classes.input}
onChange={(e) => setDescription(e.target.value)}
label={t('GENERIC_REQUIRED')}
placeholder={t('APPS_MARKETPLACE_FORM_DESCRIPTION')}
inputProps={{
className: classes.multilineFieldInput,
maxLength: 130,
}}
style={{ width: '80%' }}
size="medium"
InputLabelProps={{
shrink: true,
}}
multiline
rows={4}
variant="outlined"
/>
<Button onClick={addListing} className={classes.postButton}>
Post
</Button>
</div>
);
};
@@ -2,9 +2,7 @@ import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHome } from '@fortawesome/free-solid-svg-icons';
import AddCircleIcon from '@material-ui/icons/AddCircle';
import { AddCircle, Home } from '@material-ui/icons/';
const useStyles = makeStyles((theme) => ({
root: {
@@ -28,12 +26,8 @@ export const NavigationBar = () => {
showLabels
className={classes.root}
>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faHome} />}
to="/sellout"
/>
<BottomNavigationAction component={Link} icon={<AddCircleIcon />} to="/sellout/new" />
<BottomNavigationAction component={Link} icon={<Home />} to="/marketplace" />
<BottomNavigationAction component={Link} icon={<AddCircle />} to="/marketplace/new" />
</BottomNavigation>
);
};
+53
View File
@@ -0,0 +1,53 @@
import { atom, selector, useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { ServerPromiseResp } from '../../../../../typings/common';
import { MarketplaceEvents, MarketplaceListing } from '../../../../../typings/marketplace';
import { fetchNui } from '../../../utils/fetchNui';
import { isEnvBrowser } from '../../../utils/misc';
const defaultData: MarketplaceListing[] = [
{
id: 1,
name: 'Some guy',
number: '111-1134',
username: 'Taso',
title: 'eeeeeeeeeeeeeeeeeeeeeeeee',
description:
'skldfsdEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE',
url: 'https://i.file.glass/706Y3.jpeg',
},
{
id: 2,
name: 'Some other dude',
number: '666-6666',
username: 'Taso',
title: 'Material',
description: 'Selling my wife',
url: '',
},
];
export const listingState = atom<MarketplaceListing[]>({
key: 'listings',
default: selector({
key: 'defaultListings',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<MarketplaceListing[]>>(
MarketplaceEvents.FETCH_LISTING,
);
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return defaultData;
}
console.error(e);
return [];
}
},
}),
});
export const useListingValue = () => useRecoilValue(listingState);
export const useSetListings = () => useSetRecoilState(listingState);
export const useListings = () => useRecoilState(listingState);
@@ -0,0 +1,38 @@
import { useCallback } from 'react';
import { listingState, useSetListings } from './state';
import { MarketplaceListing } from '../../../../../typings/marketplace';
import { useRecoilValueLoadable } from 'recoil';
interface MarketplaceActionValues {
deleteListing: (id: number) => void;
addListing: (listing: MarketplaceListing) => void;
}
export const useMarketplaceActions = (): MarketplaceActionValues => {
const { state: valueLoading, contents } = useRecoilValueLoadable(listingState);
const setListings = useSetListings();
const deleteListing = useCallback(
(id: number) => {
// Make sure our atom is actually loaded before we attempt a dispatch
if (valueLoading !== 'hasValue') return;
// Tts possible for the init fetch to fail and empty array is passed. In that case
// block dispatch
if (!contents.length) return;
setListings((curListings) => [...curListings].filter((listing) => listing.id !== id));
},
[setListings, valueLoading, contents],
);
const addListing = useCallback(
(listing: MarketplaceListing) => {
// Make sure our atom is actually loaded before we attempt a dispatch
if (valueLoading !== 'hasValue') return;
setListings((curListings) => [...curListings, listing]);
},
[setListings, valueLoading],
);
return { deleteListing, addListing };
};
@@ -0,0 +1,38 @@
import { useNuiEvent } from 'fivem-nui-react-lib';
import {
MarketplaceBroadcastAddDTO,
MarketplaceDeleteDTO,
MarketplaceEvents,
} from '../../../../../typings/marketplace';
import { useMarketplaceActions } from './useMarketplaceActions';
import { useCallback } from 'react';
export const useMarketplaceService = () => {
const { addListing, deleteListing } = useMarketplaceActions();
const addListingHandler = useCallback(
(resp: MarketplaceBroadcastAddDTO) => {
addListing(resp.listing);
},
[addListing],
);
const deleteListingHandler = useCallback(
(listing: MarketplaceDeleteDTO) => {
deleteListing(listing.id);
},
[deleteListing],
);
useNuiEvent<MarketplaceBroadcastAddDTO>(
'MARKETPLACE',
MarketplaceEvents.BROADCAST_ADD,
addListingHandler,
);
useNuiEvent<MarketplaceDeleteDTO>(
'MARKETPLACE',
MarketplaceEvents.BROADCAST_DELETE,
deleteListingHandler,
);
};
@@ -0,0 +1,18 @@
import { common, red } from '@material-ui/core/colors';
export const MARKETPLACE_APP_PRIMARY_COLOR = red[500];
export const MARKETPLACE_APP_ICON_COLOR = common.white;
export const MARKETPLACE_APP_TEXT_COLOR = common.black;
const theme = {
palette: {
primary: {
main: MARKETPLACE_APP_PRIMARY_COLOR,
dark: red[700],
light: red[200],
contrastText: MARKETPLACE_APP_TEXT_COLOR,
},
},
};
export default theme;
@@ -0,0 +1,5 @@
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
import marketplaceTheme from '../marketplace.theme';
export const MarketplaceThemeProvider = createAppThemeProvider(marketplaceTheme);
@@ -0,0 +1,163 @@
import React, { useState, useRef } from 'react';
import { Card, Fab, Box, Tooltip } from '@material-ui/core';
import CancelIcon from '@material-ui/icons/Clear';
import FireIcon from '@material-ui/icons/Whatshot';
import { makeStyles } from '@material-ui/core/styles';
import { useTranslation } from 'react-i18next';
import { FormattedProfile } from '../../../../../typings/match';
import Draggable from './Draggable';
import StatusDisplay from './StatusDisplay';
import Profile from './profile/Profile';
const useStyles = makeStyles({
root: {
position: 'absolute',
margin: '15px 15px 25px 15px',
height: 'calc(100% - 90px)',
width: 'calc(100% - 30px)',
overflow: 'hidden',
cursor: 'pointer',
},
media: {
height: '60%',
},
content: {
height: '40%',
},
status: {
position: 'absolute',
zIndex: 20,
padding: '5px 15px',
top: 40,
fontSize: '28px',
fontWeight: 'bold',
},
statusVisible: {
transition: 'opacity 0.25s ease-in-out',
},
// when a user swipes on a profile we need to hide the transition
// otherwise the status will be transitioning out when the next
// profile shows up
statusNull: {
transition: 'opacity 0s',
},
like: {
color: 'green',
border: '6px solid green',
left: 30,
transform: 'rotate(-18deg)',
},
nope: {
color: 'red',
border: '6px solid red',
right: 30,
transform: 'rotate(18deg)',
},
buttons: {
position: 'absolute',
bottom: '3px',
width: '100%',
height: '55px',
},
button: {
margin: '0px 15px',
},
});
interface IProps {
profile: FormattedProfile;
onSwipe: (id: number, liked: boolean) => void;
}
// this represents how far from the original mouse
// click a user has to drag the profile in order for
// it to be registered as a like or dislike
const DECISION_THRESHOLD_X_px = 150;
const ActiveProfile = ({ profile, onSwipe }: IProps) => {
const c = useStyles();
const { t } = useTranslation();
const [status, setStatus] = useState(null);
const statusRef = useRef(null);
const idRef = useRef(null);
// we are reading mutated state from the Draggable element so we
// keep track of it using a ref. Without this ref it will appear
// from React's point of view that the state is not updating
statusRef.current = status;
idRef.current = profile.id;
function onDrag(deltaX: number): void {
const hasDecision = status !== null;
if (!hasDecision && deltaX > DECISION_THRESHOLD_X_px) {
setStatus(true);
} else if (!hasDecision && deltaX < -DECISION_THRESHOLD_X_px) {
setStatus(false);
} else if (deltaX > -DECISION_THRESHOLD_X_px && deltaX < DECISION_THRESHOLD_X_px) {
setStatus(null);
}
}
// handles when user uses mouse to "swipe", or
// more specifically drag the card to one side or the other
const handleSwipe = () => {
onSwipe(idRef.current, statusRef.current);
setStatus(null);
};
// these handlers are explicit and used for when the
// user clicks on buttons
const handleLike = () => {
onSwipe(idRef.current, true);
setStatus(null);
};
const handleNope = () => {
onSwipe(idRef.current, false);
setStatus(null);
};
const isLiked = status === true;
const notLiked = status === false;
const likeClass = `${c.status} ${isLiked ? c.statusVisible : c.statusNull} ${c.like}`;
const nopeClass = `${c.status} ${notLiked ? c.statusVisible : c.statusNull} ${c.nope}`;
return (
<>
<Draggable id="active-profile" onDrag={onDrag} onDrop={handleSwipe}>
<Card raised className={c.root}>
<StatusDisplay className={likeClass} text={t('APPS_MATCH_LIKED')} visible={isLiked} />
<StatusDisplay className={nopeClass} text={t('APPS_MATCH_NOPE')} visible={notLiked} />
<Profile profile={profile} />
</Card>
</Draggable>
<Box className={c.buttons} display="flex" justifyContent="center">
<Tooltip title={t('APPS_MATCH_DISLIKE')} aria-label="dislike">
<Fab
size="large"
color="secondary"
aria-label="dislike"
onClick={handleNope}
className={c.button}
>
<CancelIcon />
</Fab>
</Tooltip>
<Tooltip title={t('APPS_MATCH_LIKE')} aria-label="like">
<Fab
size="large"
color="primary"
aria-label="like"
onClick={handleLike}
className={c.button}
>
<FireIcon />
</Fab>
</Tooltip>
</Box>
</>
);
};
export default ActiveProfile;
@@ -0,0 +1,27 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import HomeIcon from '@material-ui/icons/Whatshot';
import GroupIcon from '@material-ui/icons/Group';
import ProfileIcon from '@material-ui/icons/Person';
const useStyles = makeStyles({
root: {
width: '100%',
},
});
export function MatchBottomNavigation({ activePage, handleChange }) {
const classes = useStyles();
return (
<BottomNavigation value={activePage} onChange={handleChange} className={classes.root}>
<BottomNavigationAction component={Link} to="/match" icon={<HomeIcon />} />
<BottomNavigationAction component={Link} to="/match/matches" icon={<GroupIcon />} />
<BottomNavigationAction component={Link} to="/match/profile" icon={<ProfileIcon />} />
</BottomNavigation>
);
}
export default MatchBottomNavigation;
@@ -0,0 +1,61 @@
import React, { useEffect, useRef } from 'react';
import { makeStyles } from '@material-ui/core';
import { LikeorDislikeDraggableElement } from '../utils/drag';
const useStyles = makeStyles({
root: {
position: 'relative',
height: '100%',
width: '100%',
},
like: {
position: 'absolute',
zIndex: 20,
padding: '5px 15px',
top: 100,
color: 'green',
border: '4px solid green',
right: 15,
},
nope: {
position: 'absolute',
zIndex: 20,
padding: '5px 15px',
top: 100,
color: 'red',
border: '4px solid red',
left: 15,
},
});
interface IProps {
id: string;
children: JSX.Element | JSX.Element[];
onDrag: (deltaX: number) => void;
onDrop: () => void;
}
const MAX_ROTATION_DEG = 15;
function Draggable({ id, children, onDrag, onDrop }: IProps) {
const classes = useStyles();
const elementRef = useRef(null);
useEffect(() => {
const drag = new LikeorDislikeDraggableElement(elementRef, MAX_ROTATION_DEG, onDrag, onDrop);
return () => drag.cleanup();
}, [elementRef]); // eslint-disable-line
return (
<>
<div ref={elementRef} key={id} id={id} className={classes.root}>
{children}
</div>
</>
);
}
export default Draggable;
+28
View File
@@ -0,0 +1,28 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Box, Typography } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
const useStyles = makeStyles((theme: Theme) => ({
root: {
color: theme.palette.primary.main,
fontSize: theme.typography.fontSize,
height: '100%',
width: '100%',
display: 'flex',
justifyContent: 'center',
paddingTop: '140px',
},
}));
function NoProfiles() {
const classes = useStyles();
const { t } = useTranslation();
return (
<Box className={classes.root}>
<Typography variant="h5">{t('APPS_MATCH_NO_PROFILES')}</Typography>
</Box>
);
}
export default NoProfiles;
@@ -0,0 +1,26 @@
import React from 'react';
import { Box, CircularProgress } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles({
root: {
height: '100%',
width: '100%',
display: 'flex',
justifyContent: 'center',
},
progress: {
marginTop: '140px',
},
});
function Loader() {
const classes = useStyles();
return (
<Box className={classes.root}>
<CircularProgress size={60} className={classes.progress} />
</Box>
);
}
export default Loader;
@@ -0,0 +1,31 @@
import React, { useState } from 'react';
import { AppWrapper } from '../../../ui/components';
import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from '../../../ui/components/AppContent';
import { useApp } from '../../../os/apps/hooks/useApps';
import { MatchThemeProvider } from '../providers/MatchThemeProvider';
import MatchBottomNavigation from '../components/BottomNavigation';
import MatchContainer from './MatchContainer';
import { LoadingSpinner } from '../../../ui/components/LoadingSpinner';
export const MatchApp = () => {
const match = useApp('MATCH');
const [activePage, setActivePage] = useState(0);
const handlePageChange = (e, page) => setActivePage(page);
return (
<MatchThemeProvider>
<AppWrapper id="contact-app">
<AppTitle app={match} />
<AppContent>
<React.Suspense fallback={<LoadingSpinner />}>
<MatchContainer />
</React.Suspense>
</AppContent>
<MatchBottomNavigation activePage={activePage} handleChange={handlePageChange} />
</AppWrapper>
</MatchThemeProvider>
);
};
@@ -0,0 +1,35 @@
import React, { useEffect } from 'react';
import { LoadingSpinner } from '../../../ui/components/LoadingSpinner';
import ProfileEditor from './views/ProfileEditor';
import { Route } from 'react-router-dom';
import MatchPage from './views/MatchPage';
import MatchList from './views/MatchList';
import { useProfile } from '../hooks/useProfile';
const MatchContainer: React.FC = () => {
const { profile, noProfileExists, setNoProfileExists } = useProfile();
useEffect(() => {
if (!profile) {
setNoProfileExists(true);
} else {
setNoProfileExists(false);
}
}, [setNoProfileExists, profile]);
return (
<React.Suspense fallback={<LoadingSpinner />}>
{noProfileExists ? (
<ProfileEditor />
) : (
<>
<Route path="/match/" exact component={MatchPage} />
<Route path="/match/matches" exact component={MatchList} />
<Route path="/match/profile" exact component={ProfileEditor} />
</>
)}
</React.Suspense>
);
};
export default MatchContainer;
@@ -0,0 +1,31 @@
import React from 'react';
import { Box, Typography } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
const useStyles = makeStyles((theme: Theme) => ({
root: {
color: theme.palette.primary.main,
fontSize: theme.typography.fontSize,
height: '100%',
width: '100%',
display: 'flex',
justifyContent: 'center',
textAlign: 'center',
padding: '140px 15px 15px 15px',
},
}));
interface IProps {
text: string;
}
function PageText({ text }: IProps) {
const classes = useStyles();
return (
<Box className={classes.root}>
<Typography variant="h5">{text}</Typography>
</Box>
);
}
export default PageText;
@@ -0,0 +1,14 @@
import React from 'react';
import { Box } from '@material-ui/core';
function StatusDisplay({ className, visible, text }) {
const style = { opacity: visible ? '0.65' : '0.0' };
return (
<Box className={className} style={style}>
{text}
</Box>
);
}
export default StatusDisplay;
@@ -0,0 +1,62 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import ListItemText from '@material-ui/core/ListItemText';
import { Box, Button, ListItem, makeStyles } from '@material-ui/core';
import PersonIcon from '@material-ui/icons/Person';
import ChatIcon from '@material-ui/icons/Chat';
import { FormattedMatch } from '../../../../../../typings/match';
import Profile from '../profile/Profile';
const useStyles = makeStyles({
profile: {
position: 'relative',
height: '90%',
marginTop: '15px',
},
});
interface IProps {
match: FormattedMatch;
}
export const Match = ({ match }: IProps) => {
const history = useHistory();
const classes = useStyles();
const { t } = useTranslation();
const [showProfile, setShowProfile] = useState(false);
const handleMessage = () => {
history.push(`/messages/new/${match.phoneNumber}`);
};
const handleProfile = () => {
setShowProfile((show) => !show);
};
const secondaryText = t('APPS_MATCH_PROFILE_MATCHED_AT', {
matchedAt: match.matchedAtFormatted,
});
return (
<>
<ListItem divider>
<ListItemText primary={match.name} secondary={secondaryText} />
<Button onClick={handleProfile}>
<PersonIcon />
</Button>
<Button onClick={handleMessage}>
<ChatIcon />
</Button>
</ListItem>
{showProfile && (
<Box className={classes.profile}>
<Profile profile={match} />
</Box>
)}
</>
);
};
export default Match;
@@ -0,0 +1,77 @@
import React from 'react';
import { CardContent, CardMedia, Chip, Typography } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { useTranslation } from 'react-i18next';
import { FormattedProfile, FormattedMatch } from '../../../../../../typings/match';
const useStyles = makeStyles({
tags: {
position: 'absolute',
bottom: '40%',
},
tag: {
margin: '3px 3px 0px 0px',
opacity: '0.8',
},
media: {
height: '60%',
},
content: {
height: '40%',
overflowY: 'auto',
},
});
interface IProps {
profile: FormattedProfile | FormattedMatch;
}
const DEFAULT_IMAGE = 'https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg';
const Profile = ({ profile }: IProps) => {
const c = useStyles();
const { t } = useTranslation();
function parseSecondaryBio(): string | undefined {
const { location, job } = profile;
if (location && job) {
return `${location} - ${job}`;
} else if (location) {
return location;
} else if (job) {
return job;
}
}
const bioSecondary = parseSecondaryBio();
return (
<>
<CardContent className={c.tags}>
{profile.tagList.map((tag) => (
<Chip className={c.tag} label={tag} color="primary" />
))}
</CardContent>
<CardMedia className={c.media} image={profile.image || DEFAULT_IMAGE} title={profile.name} />
<CardContent className={c.content}>
<Typography gutterBottom variant="h4" component="h2">
{profile.name}
</Typography>
<Typography gutterBottom color="textSecondary" component="p">
{t('APPS_MATCH_PROFILE_LAST_ACTIVE', { lastActive: profile.lastActiveFormatted })}
</Typography>
{bioSecondary && (
<Typography gutterBottom variant="body1" color="textSecondary" component="p">
{bioSecondary}
</Typography>
)}
<Typography variant="body2" color="textSecondary" component="p">
{profile.bio}
</Typography>
</CardContent>
</>
);
};
export default Profile;
@@ -0,0 +1,148 @@
import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { useTranslation } from 'react-i18next';
import {
Profile as IProfile,
FormattedProfile,
MatchEvents,
} from '../../../../../../typings/match';
import ProfileField from '../../../../ui/components/ProfileField';
import UpdateButton from '../../../../ui/components/UpdateButton';
import { Card } from '@material-ui/core';
import Profile from './Profile';
import { usePhone } from '../../../../os/phone/hooks/usePhone';
import PageText from '../PageText';
import { fetchNui } from '../../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../../typings/common';
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
import { useSetMyProfile } from '../../hooks/state';
const useStyles = makeStyles({
root: {
position: 'relative',
width: '100%',
height: 'calc(100% - 40px)',
padding: '15px',
},
card: {
position: 'absolute',
margin: '15px 15px 25px 15px',
height: 'calc(100% - 80px)',
width: 'calc(100% - 30px)',
overflow: 'hidden',
},
spacer: {
height: '8px',
},
});
interface IProps {
profile: FormattedProfile;
showPreview: boolean;
}
export function ProfileForm({ profile, showPreview }: IProps) {
const classes = useStyles();
const { t } = useTranslation();
const { ResourceConfig } = usePhone();
const { addAlert } = useSnackbar();
const setMyProfile = useSetMyProfile();
// note that this assumes we are defensively checking
// that profile is not null in a parent above this component.
// Annoyingling adding conditionals above this line to not render
// when profile === null results in a react error that different
// amounts of hooks are rendering
const [image, setImage] = useState(profile?.image || '');
const [name, setName] = useState(profile?.name || '');
const [bio, setBio] = useState(profile?.bio || '');
const [job, setJob] = useState(profile?.job || '');
const [location, setLocation] = useState(profile?.location || '');
const [tags, setTags] = useState(profile?.tags || '');
const update: FormattedProfile = {
...profile,
image,
name,
bio,
location,
job,
tagList: tags.split(',').map((tag) => tag.trim()),
};
const handleUpdate = () => {
const updatedProfile: IProfile = {
...update,
name: update.name.trim(),
image: update.image.trim(),
tags: update.tagList.join(','),
};
const event = profile ? MatchEvents.UPDATE_MY_PROFILE : MatchEvents.CREATE_MY_PROFILE;
fetchNui<ServerPromiseResp<FormattedProfile>>(event, updatedProfile).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: 'APPS_MATCH_UPDATE_PROFILE_FAILED',
type: 'error',
});
}
setMyProfile(resp.data);
addAlert({
message: 'APPS_MATCH_UPDATE_PROFILE_SUCCEEDED',
type: 'success',
});
});
};
if (!profile /* && !ResourceConfig.match.allowEditableProfileName*/) {
return <PageText text={t('APPS_MATCH_PROFILE_CONFIGURATION')} />;
}
if (showPreview) {
return (
<Card raised className={classes.card}>
<Profile profile={update} />
</Card>
);
}
return (
<div className={classes.root}>
<ProfileField
label={t('APPS_MATCH_EDIT_PROFILE_IMAGE')}
value={update.image}
handleChange={setImage}
allowChange
/>
<ProfileField
label={t('APPS_MATCH_EDIT_PROFILE_NAME')}
value={name}
handleChange={setName}
allowChange={ResourceConfig.match.allowEditableProfileName}
/>
<ProfileField
label={t('APPS_MATCH_EDIT_PROFILE_BIO')}
value={update.bio}
handleChange={setBio}
multiline
maxLength={250}
/>
<ProfileField
label={t('APPS_MATCH_EDIT_PROFILE_LOCATION')}
value={update.location}
handleChange={setLocation}
/>
<ProfileField
label={t('APPS_MATCH_EDIT_PROFILE_JOB')}
value={update.job}
handleChange={setJob}
maxLength={50}
/>
<ProfileField label={t('APPS_MATCH_EDIT_PROFILE_TAGS')} value={tags} handleChange={setTags} />
<UpdateButton handleClick={handleUpdate} loading={false} />
</div>
);
}
export default ProfileForm;
@@ -0,0 +1,34 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Box, makeStyles } from '@material-ui/core';
import Loader from '../Loader';
import PageText from '../PageText';
import Match from '../matches/Match';
import { useMatches } from '../../hooks/useMatches';
const useStyles = makeStyles({
root: {
height: '100%',
},
});
function MatchList() {
const classes = useStyles();
const { t } = useTranslation();
const { matches, error } = useMatches();
if (error) return <PageText text={t('APPS_MATCH_MATCHES_ERROR')} />;
if (!matches) return <Loader />;
if (matches.length === 0) return <PageText text={t('APPS_MATCH_NO_MATCHES')} />;
return (
<Box className={classes.root}>
{matches.map((match) => (
<Match key={match.id} match={match} />
))}
</Box>
);
}
export default MatchList;
@@ -0,0 +1,55 @@
import React, { useEffect, useState } from 'react';
import { Paper } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { useTranslation } from 'react-i18next';
import { useProfiles } from '../../hooks/useProfiles';
import Loader from '../Loader';
import PageText from '../PageText';
import ActiveProfile from '../ActiveProfile';
import { useMatchActions } from '../../hooks/useMatchActions';
const useStyles = makeStyles({
root: {
height: '100%',
width: '100%',
overflow: 'hidden',
},
});
// set a minimum load time so the user doesn't see a flash
// of the loader and then the matches themselves
const MINIMUM_LOAD_TIME = 1250;
const MatchPage = () => {
const classes = useStyles();
const { t } = useTranslation();
const { profiles, error, activeProfile } = useProfiles();
const { setViewed } = useMatchActions();
const [loaded, setLoaded] = useState(false);
useEffect(() => {
window.setTimeout(() => {
setLoaded(true);
}, MINIMUM_LOAD_TIME);
}, []);
const handleSwipe = (id: number, liked: boolean) => {
// the user didn't choose (didn't swipe far enough)
if (liked === null) return;
setViewed(id, liked);
};
if (error) return <PageText text={t('APPS_MATCH_PROFILES_ERROR')} />;
if (!loaded || !profiles) return <Loader />;
if (!activeProfile) return <PageText text={t('APPS_MATCH_NO_PROFILES')} />;
return (
<Paper className={classes.root} square>
<ActiveProfile profile={activeProfile} onSwipe={handleSwipe} />
</Paper>
);
};
export default MatchPage;
@@ -0,0 +1,44 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { makeStyles } from '@material-ui/core/styles';
import { Box, FormControlLabel, Switch } from '@material-ui/core';
import Loader from '../Loader';
import ProfileForm from '../profile/ProfileForm';
import { useProfile } from '../../hooks/useProfile';
const useStyles = makeStyles({
root: {
height: '100%',
width: '100%',
},
switch: {
marginLeft: '15px',
},
});
function ProfileEditor() {
const { profile, noProfileExists } = useProfile();
const classes = useStyles();
const { t } = useTranslation();
const [showPreview, setShowPreview] = useState(false);
const toggleSwitch = () => {
setShowPreview((preview) => !preview);
};
if (!profile && !noProfileExists) return <Loader />;
return (
<Box className={classes.root}>
<Box className={classes.switch}>
<FormControlLabel
control={<Switch checked={showPreview} onChange={toggleSwitch} />}
label={t('APPS_MATCH_EDIT_PROFILE_PREVIEW')}
/>
</Box>
<ProfileForm showPreview={showPreview} profile={profile} />
</Box>
);
}
export default ProfileEditor;
+98
View File
@@ -0,0 +1,98 @@
import { atom, selector, useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { FormattedMatch, FormattedProfile, MatchEvents } from '../../../../../typings/match';
import { fetchNui } from '../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../typings/common';
import LogDebugEvent from '../../../os/debug/LogDebugEvents';
import { isEnvBrowser } from '../../../utils/misc';
import { MockMatchesData, MockMyProfileData, MockProfilesData } from '../utils/constants';
export const matchState = {
profiles: atom<FormattedProfile[]>({
key: 'profiles',
default: selector({
key: 'matchDefaultProfiles',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<FormattedProfile[]>>(
MatchEvents.GET_PROFILES,
);
LogDebugEvent({ action: 'fetchProfiles', data: resp.data });
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return MockProfilesData;
}
console.error(e);
return [];
}
},
}),
}),
errorLoadingProfiles: atom<boolean>({
key: 'errorLoadingProfiles',
default: false,
}),
matches: atom<FormattedMatch[]>({
key: 'matches',
default: selector({
key: 'defaultMatches',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<FormattedMatch[]>>(MatchEvents.GET_MATCHES);
LogDebugEvent({ action: 'fetchMatches', data: resp.data });
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return MockMatchesData;
}
console.log(e);
return [];
}
},
}),
}),
errorLoadingMatches: atom<boolean>({
key: 'errorLoadingMatches',
default: false,
}),
myProfile: atom<FormattedProfile | null>({
key: 'myProfile',
default: selector({
key: 'myProfileDefault',
get: async () => {
try {
const resp = await fetchNui<ServerPromiseResp<FormattedProfile>>(
MatchEvents.GET_MY_PROFILE,
);
LogDebugEvent({ action: 'fetchMyProfile', data: resp.data });
return resp.data;
} catch (e) {
if (isEnvBrowser()) {
return MockMyProfileData;
}
console.error(e);
return null;
}
},
}),
}),
noProfileExists: atom<boolean>({
key: 'noProfileExists',
default: false,
}),
};
export const useFormattedProfiles = () => useRecoilState(matchState.profiles);
export const useFormattedProfilesValue = () => useRecoilValue(matchState.profiles);
export const useSetFormattedProfiles = () => useSetRecoilState(matchState.profiles);
export const useMyProfile = () => useRecoilState(matchState.myProfile);
export const useMyProfileValue = () => useRecoilValue(matchState.myProfile);
export const useSetMyProfile = () => useSetRecoilState(matchState.myProfile);
export const useProfileExistsValue = () => useRecoilValue(matchState.noProfileExists);
export const useProfileExists = () => useRecoilState(matchState.noProfileExists);
export const useFormattedMatches = () => useRecoilState(matchState.matches);
export const useMatchesValue = () => useRecoilValue(matchState.matches);
export const useSetMatches = () => useSetRecoilState(matchState.matches);
@@ -0,0 +1,51 @@
import { FormattedMatch, MatchEvents } from '../../../../../typings/match';
import { fetchNui } from '../../../utils/fetchNui';
import { ServerPromiseResp } from '../../../../../typings/common';
import { useSetFormattedProfiles, useSetMatches } from './state';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useCallback } from 'react';
export const useMatchActions = () => {
const setProfiles = useSetFormattedProfiles();
const setMatches = useSetMatches();
const { addAlert } = useSnackbar();
const setViewed = useCallback(
(id: number, liked: boolean) => {
setProfiles((profiles) =>
profiles.map((profile) => {
if (id === profile.id) return { ...profile, viewed: true, liked };
return profile;
}),
);
fetchNui<ServerPromiseResp<boolean>>(MatchEvents.SAVE_LIKES, [{ id, liked }]).then((resp) => {
if (resp.status !== 'ok') {
return addAlert({
message: 'APPS_MATCH_SAVE_LIKES_FAILED',
type: 'error',
});
}
// Instead of just fetching the matches again, we might want to first format the profile to a 'Match',then to a 'FormattedMatch'
// and then just mutate the already existing state of matches?
// I guess that's for another time :P
if (resp.data) {
addAlert({
message: 'APPS_MATCH_NEW_LIKE_FOUND',
type: 'info',
});
fetchNui<ServerPromiseResp<FormattedMatch[]>>(MatchEvents.GET_MATCHES).then((resp) => {
setMatches(resp.data);
});
}
});
},
[setProfiles, addAlert, setMatches],
);
return {
setViewed,
};
};
+16
View File
@@ -0,0 +1,16 @@
import { matchState, useFormattedMatches } from './state';
import { useRecoilValue } from 'recoil';
import { FormattedMatch } from '../../../../../typings/match';
interface UseMatchProps {
matches: FormattedMatch[];
setMatches: (matches: FormattedMatch[]) => void;
error: boolean;
}
export const useMatches = (): UseMatchProps => {
const [matches, setMatches] = useFormattedMatches();
const error = useRecoilValue(matchState.errorLoadingMatches);
return { matches, setMatches, error };
};
+16
View File
@@ -0,0 +1,16 @@
import { useMyProfile, useProfileExists } from './state';
import { FormattedProfile } from '../../../../../typings/match';
interface UseProfileProps {
profile: FormattedProfile;
setProfile: (profile: FormattedProfile) => void;
noProfileExists: boolean;
setNoProfileExists: (exists: boolean) => void;
}
export const useProfile = (): UseProfileProps => {
const [profile, setProfile] = useMyProfile();
const [noProfileExists, setNoProfileExists] = useProfileExists();
return { profile, setProfile, noProfileExists, setNoProfileExists };
};
+20
View File
@@ -0,0 +1,20 @@
import { useRecoilValue } from 'recoil';
import { matchState, useFormattedProfiles } from './state';
import { FormattedProfile } from '../../../../../typings/match';
interface UseProfilesProps {
profiles: FormattedProfile[];
activeProfile: FormattedProfile | null;
error: boolean;
}
export const useProfiles = (): UseProfilesProps => {
const [profiles] = useFormattedProfiles();
const error = useRecoilValue(matchState.errorLoadingProfiles);
const filteredProfiles = profiles ? profiles.filter((profile) => !profile.viewed) : null;
const activeProfile = profiles ? filteredProfiles[0] : null;
return { profiles, activeProfile, error };
};
+27
View File
@@ -0,0 +1,27 @@
import { red, common } from '@material-ui/core/colors';
export const MATCH_APP_PRIMARY_COLOR = '#FE3B73';
export const MATCH_APP_TEXT_COLOR = common.white;
const theme = {
palette: {
primary: {
main: MATCH_APP_PRIMARY_COLOR,
dark: red[700],
light: red[300],
contrastText: MATCH_APP_TEXT_COLOR,
},
secondary: {
main: '#d32f2f',
light: '#eb4242',
dark: '#941212',
contrastText: MATCH_APP_TEXT_COLOR,
},
success: {
main: '#2196f3',
contrastText: MATCH_APP_TEXT_COLOR,
},
},
};
export default theme;
@@ -0,0 +1,5 @@
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
import matchTheme from '../match.theme';
export const MatchThemeProvider = createAppThemeProvider(matchTheme);
+116
View File
@@ -0,0 +1,116 @@
import { FormattedMatch, FormattedProfile } from '../../../../../typings/match';
export const MockProfilesData: FormattedProfile[] = [
{
id: 1,
identifier: '3r523242',
viewed: false,
image:
'https://cdn.vox-cdn.com/thumbor/9xCALlkm2Mc0HQk8kMr1Ui3YNbc=/0x0:5464x3070/920x613/filters:focal(2295x1098:3169x1972):format(webp)/cdn.vox-cdn.com/uploads/chorus_image/image/67031748/shutterstock_1450403549.0.jpg',
name: 'Evan You',
bio: 'Husband, father of two, independent open source developer. Creator / project lead of @vuejs, @vite_js and connoisseur of sushi.',
createdAt: 1615932985,
updatedAt: 1615932985,
lastActive: 1616004986,
job: 'Gardener',
location: 'Grapeseed',
tags: 'shit framework, vue sucks',
phoneNumber: '987-6543',
tagList: ['shitframework', 'vue sucks'],
lastActiveFormatted: '1616004986',
},
{
id: 2,
identifier: '3r523242',
viewed: false,
image:
'https://media.cntraveler.com/photos/5f8f09c3a078e9112956774d/16:9/w_1600%2Cc_limit/Chicago-GettyImages-1065188752.jpg',
name: 'Person Beta',
bio: 'l impedit quo minus id quod maxime placeat facere possimus',
createdAt: 1615846585,
updatedAt: 1615846585,
lastActive: 1615850185,
job: 'Mechanic',
location: 'Harmony',
tags: 'tinkering,robotics',
phoneNumber: '654-3219',
tagList: ['tinkering', 'robotics'],
lastActiveFormatted: '12332425',
},
{
id: 3,
identifier: '3r523242',
viewed: false,
image: 'https://www.langan.com/wp-content/uploads/2019/02/Boston-996x554.jpg',
name: 'Person Charlie',
bio: 'ut aut reiciendis voluptatibus',
createdAt: 1615850185,
updatedAt: 1615850185,
lastActive: 1613607385,
job: 'Lawyer',
location: 'Los Santos',
tags: 'reading,coolstuff, coffee',
phoneNumber: '123-4567',
tagList: ['reading', 'coolstuff', 'coffee'],
lastActiveFormatted: '12332425',
},
];
export const MockMyProfileData: FormattedProfile = {
id: 4,
identifier: '4785656',
viewed: false,
image:
'https://www.middlebury.edu/institute/sites/www.middlebury.edu.institute/files/styles/1040x585/public/2018-10/Nashville-skyline.jpg?fv=mS11EKrT&itok=HNhHqYUX',
name: 'Kire Says',
bio: "Kire's cool profile that has many cool things. And others.",
createdAt: 1615932985,
updatedAt: 1615932985,
lastActive: 1616004986,
job: 'Engineer',
location: 'Boston',
tags: 'code,javascript',
phoneNumber: '999-9999',
tagList: ['code', 'javascript'],
lastActiveFormatted: '12332425',
};
export const MockMatchesData: FormattedMatch[] = [
{
id: 5,
identifier: '4785656',
viewed: true,
image:
'https://media.cntraveler.com/photos/5f8f09c3a078e9112956774d/16:9/w_1600%2Cc_limit/Chicago-GettyImages-1065188752.jpg',
name: 'Taso',
bio: 'l impedit quo minus id quod maxime placeat facere possimus',
createdAt: 1615846585,
updatedAt: 1615846585,
lastActive: 1615850185,
job: 'Mechanic',
location: 'Harmony',
tags: 'tinkering,robotics',
tagList: ['tinkering', 'robotics'],
lastActiveFormatted: '525343252',
matchedAtFormatted: '3452355',
phoneNumber: '654-3219',
},
{
id: 6,
identifier: '4785656',
viewed: true,
image: 'https://www.langan.com/wp-content/uploads/2019/02/Boston-996x554.jpg',
name: 'Chip',
bio: 'ut aut reiciendis voluptatibus',
createdAt: 1615850185,
updatedAt: 1615850185,
lastActive: 1613607385,
job: 'Lawyer',
location: 'Los Santos',
tags: 'reading,coolstuff, coffee',
tagList: ['reading', 'coolstuff', 'coffee'],
phoneNumber: '123-4567',
lastActiveFormatted: '525343252',
matchedAtFormatted: '3452355',
},
];
Loaded 100 of 403 files, more files were not shown because too many files have changed in this diff. Show more