From fc1f6b3ad3e254d620da39999c1381af9ee6c084 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 18:51:08 +0100 Subject: [PATCH 01/11] feat(notes/nui): notes alert --- phone/src/apps/notes/alert/NotesAlert.tsx | 62 +++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 phone/src/apps/notes/alert/NotesAlert.tsx diff --git a/phone/src/apps/notes/alert/NotesAlert.tsx b/phone/src/apps/notes/alert/NotesAlert.tsx new file mode 100644 index 0000000..c760082 --- /dev/null +++ b/phone/src/apps/notes/alert/NotesAlert.tsx @@ -0,0 +1,62 @@ +import React, { useState, useEffect, useCallback } from 'react' +import { Snackbar } from '@material-ui/core'; +import { Alert } from '../../../ui/components/Alert'; +import { AlertCategory } from '../../../common/typings/notes'; +import { useTranslation } from 'react-i18next'; +import { useNotesAlert } from '../hooks/useNoteAlert'; + +const LOCALE_PREFIX = 'APPS_'; + +export const NotesAlert = () => { + const { t } = useTranslation(); + const [open, setOpen] = useState(false); + const { alert, setAlert } = useNotesAlert(); + const [message, setMessage] = useState(null); + const [severity, setSeverity] = useState(''); + + const _handleClose = () => { + setOpen(false) + setAlert(null) + } + + const setMessageAlert = useCallback((type: AlertCategory, severity: 'success' | 'error') => { + setMessage(t(LOCALE_PREFIX + type)); + setSeverity(severity) + setOpen(true) + }, [t]) + + useEffect(() => { + switch (alert) { + case 'NOTES_ADD_SUCCESS': + setMessageAlert(alert, 'success'); + break; + case 'NOTES_ADD_FAILED': + setMessageAlert(alert, 'error'); + break; + case 'NOTES_UPDATE_SUCCESS': + setMessageAlert(alert, 'success'); + break; + case 'NOTES_UPDATE_FAILED': + setMessageAlert(alert, 'error'); + break; + case 'NOTES_DELETE_SUCCESS': + setMessageAlert(alert, 'success'); + break; + case 'NOTES_DELETE_FAILED': + setMessageAlert(alert, 'error') + } + }, [alert, setMessageAlert]) + + return ( + + + {message} + + + ) +} From 59973fcf9e4ae886f2051e7565bf16560d860620 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 18:52:04 +0100 Subject: [PATCH 02/11] feat(notes/nui): useAlet hook --- phone/src/apps/notes/hooks/state.ts | 4 ++++ phone/src/apps/notes/hooks/useNoteAlert.ts | 8 ++++++++ phone/src/apps/notes/hooks/useNotesService.ts | 5 ++++- phone/src/common/typings/notes.ts | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 phone/src/apps/notes/hooks/useNoteAlert.ts diff --git a/phone/src/apps/notes/hooks/state.ts b/phone/src/apps/notes/hooks/state.ts index 37c31d5..b5c0ea7 100644 --- a/phone/src/apps/notes/hooks/state.ts +++ b/phone/src/apps/notes/hooks/state.ts @@ -13,4 +13,8 @@ export const noteStates = { key: 'noteDetail', default: null, }), + alert: atom({ + key: 'notesAlert', + default: null + }) }; diff --git a/phone/src/apps/notes/hooks/useNoteAlert.ts b/phone/src/apps/notes/hooks/useNoteAlert.ts new file mode 100644 index 0000000..ba081b2 --- /dev/null +++ b/phone/src/apps/notes/hooks/useNoteAlert.ts @@ -0,0 +1,8 @@ +import { useRecoilState } from 'recoil'; +import { INotesAlert } from '../../../common/typings/notes'; +import { noteStates } from './state'; + +export const useNotesAlert = (): INotesAlert => { + const [alert, setAlert] = useRecoilState(noteStates.alert) + return { alert, setAlert } +} \ No newline at end of file diff --git a/phone/src/apps/notes/hooks/useNotesService.ts b/phone/src/apps/notes/hooks/useNotesService.ts index 5e504a6..c4356c4 100644 --- a/phone/src/apps/notes/hooks/useNotesService.ts +++ b/phone/src/apps/notes/hooks/useNotesService.ts @@ -2,9 +2,12 @@ import { useSetRecoilState } from 'recoil'; import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; import { useNotes } from './useNotes'; import { noteStates } from './state'; +import { useNotesAlert } from './useNoteAlert'; export const useNotesService = () => { const setNotes = useSetRecoilState(noteStates.noteItems); + const setAlert = useSetRecoilState(noteStates.alert); useNuiEvent('NOTES', 'setNotes', setNotes); - return useNotes(); + useNuiEvent('NOTES', 'setAlert', setAlert) + return { useNotes, useNotesAlert }; }; diff --git a/phone/src/common/typings/notes.ts b/phone/src/common/typings/notes.ts index 2f70474..8d46deb 100644 --- a/phone/src/common/typings/notes.ts +++ b/phone/src/common/typings/notes.ts @@ -1,3 +1,18 @@ +export type AlertCategory = + | 'NOTES_ADD_SUCCESS' + | 'NOTES_ADD_FAILED' + | 'NOTES_UPDATE_SUCCESS' + | 'NOTES_UPDATE_FAILED' + | 'NOTES_DELETE_SUCCESS' + | 'NOTES_DELETE_FAILED' + + +export interface INotesAlert { + alert: AlertCategory; + setAlert: (type: AlertCategory) => void; +} + + export interface Note { id?: number; title: string; From 4d9284716365d58506db9ccb20fe905345d9d9fb Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 18:52:58 +0100 Subject: [PATCH 03/11] feat(notes/nui): use notes alert --- phone/src/apps/notes/NotesApp.tsx | 4 +++- phone/src/apps/notes/modal/NoteModal.tsx | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx index 7186f0c..c730344 100644 --- a/phone/src/apps/notes/NotesApp.tsx +++ b/phone/src/apps/notes/NotesApp.tsx @@ -15,6 +15,7 @@ import { useNoteDetail } from './hooks/useNoteDetail'; import useStyles from './notes.styles'; import InjectDebugData from '../../os/debug/InjectDebugData'; +import { NotesAlert } from './alert/NotesAlert'; InjectDebugData([ { @@ -32,7 +33,7 @@ InjectDebugData([ content: 'Hello, this is another shitty note', }, ], - }, + } ]); export const NotesApp = () => { @@ -65,6 +66,7 @@ export const NotesApp = () => { + ); }; diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index fb75c6e..c3c3a42 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -1,5 +1,5 @@ import { Button, TextField, Slide } from '@material-ui/core'; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import { useNoteModal } from '../hooks/useNoteModal'; @@ -14,11 +14,12 @@ import Nui from '../../../os/nui-events/utils/Nui'; export const NoteModal = () => { const { noteModal, setNoteModal } = useNoteModal(); const { detail, setDetail } = useNoteDetail(); - console.log(detail); const [title, setTitle] = useState(detail ? detail.title : ''); const [content, setContent] = useState(detail ? detail.content : ''); - const classes = useStyles(); + const classes = useStyles() + + const _handleClose = () => { setNoteModal(false); @@ -26,12 +27,14 @@ export const NoteModal = () => { }; const handleNoteSave = () => { + setNoteModal(false); setDetail(null); Nui.send('phone:addNote', { title, content, }); + setDetail(null) }; const handleDeleteNote = () => { @@ -63,6 +66,7 @@ export const NoteModal = () => {
{ className={classes.input} inputProps={{ className: classes.inputPropsContent, + maxLength: 250, }} placeholder='Content' multiline @@ -84,8 +89,9 @@ export const NoteModal = () => { value={content} onChange={(e) => setContent(e.target.value)} /> - {!detail && ( - )} From a8f025aff3a85a9c448495916108e1ff5f91a18a Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 18:54:13 +0100 Subject: [PATCH 04/11] feat(notes/client|server): sending alert results! --- resources/client/cl_notes.ts | 26 +++++++++++----------- resources/server/sv_notes.ts | 42 +++++++++++++++++++++++------------- resources/utils/apps.ts | 1 + resources/utils/events.ts | 2 ++ resources/utils/messages.ts | 4 ++++ 5 files changed, 46 insertions(+), 29 deletions(-) diff --git a/resources/client/cl_notes.ts b/resources/client/cl_notes.ts index d1ec160..7547036 100644 --- a/resources/client/cl_notes.ts +++ b/resources/client/cl_notes.ts @@ -1,19 +1,13 @@ import events from '../utils/events'; +import { sendNotesEvent } from '../utils/messages'; onNet(events.NOTE_SEND_NOTE, (notes: any) => { - SendNuiMessage( - JSON.stringify({ - app: 'NOTES', - method: 'setNotes', - data: notes, - }) - ); + sendNotesEvent('setNotes', notes); }); RegisterNuiCallbackType(events.NOTE_ADD_NOTE); on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => { - const note = data; - emitNet(events.NOTE_ADD_NOTE, note); + emitNet(events.NOTE_ADD_NOTE, data); }); onNet(events.NOTE_SEND_NOTE_SUCCESS, () => { @@ -22,18 +16,22 @@ onNet(events.NOTE_SEND_NOTE_SUCCESS, () => { RegisterNuiCallbackType(events.NOTE_DELETE_NOTE); on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => { - const noteId = data; - emitNet(events.NOTE_DELETE_NOTE, noteId); - + emitNet(events.NOTE_DELETE_NOTE, data); + emitNet(events.NOTE_FETCH_ALL_NOTES); }); RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE); on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => { - const note = data; - emitNet(events.NOTE_UPDATE_NOTE, note); + emitNet(events.NOTE_UPDATE_NOTE, data); }); onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => { emitNet(events.NOTE_FETCH_ALL_NOTES); }); + + +onNet(events.NOTE_ACTION_RESULT, (type: string) => { + console.log(type) + sendNotesEvent('setAlert', type) +}) \ No newline at end of file diff --git a/resources/server/sv_notes.ts b/resources/server/sv_notes.ts index 86a5c08..7e316fc 100644 --- a/resources/server/sv_notes.ts +++ b/resources/server/sv_notes.ts @@ -13,8 +13,7 @@ async function fetchAllNotes(identifier: string): Promise { const query = 'SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC'; const [result] = await pool.query(query, [identifier]); - const notes = result; - return notes; + return result; } async function deleteNote(noteId: number, identifier: string) { @@ -30,42 +29,55 @@ async function updateNote(note: Note, identifier: string): Promise { onNet(events.NOTE_ADD_NOTE, async (note: Note) => { try { + const pSource = (global as any).source const _identifier = await useIdentifier(); - addNote(_identifier, note); - emitNet(events.NOTE_SEND_NOTE_SUCCESS, getSource()); + await addNote(_identifier, note); + emitNet(events.NOTE_SEND_NOTE_SUCCESS, pSource); + emitNet(events.NOTE_ACTION_RESULT, pSource, 'NOTES_ADD_SUCCESS') + } catch (error) { - console.log('NOTES ERROR: ', error); + const pSource = (global as any).source + emitNet(events.NOTE_ACTION_RESULT, pSource, 'NOTES_ADD_FAILED') } }); onNet(events.NOTE_FETCH_ALL_NOTES, async () => { try { - const _source = (global as any).source; + const pSource = (global as any).source const _identifier = await useIdentifier(); const notes = await fetchAllNotes(_identifier); - emitNet(events.NOTE_SEND_NOTE, _source, notes); + emitNet(events.NOTE_SEND_NOTE, pSource, notes); + } catch (error) { - console.log('NOTE ERROR: ', error); + console.dir(error) } }); onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => { try { + const pSource = (global as any).source; const _identifier = await useIdentifier(); - const id = noteId.id; - await deleteNote(id, _identifier); + await deleteNote(noteId.id, _identifier); + + emitNet(events.NOTE_ACTION_RESULT, pSource, 'NOTES_DELETE_SUCCESS') + } catch (error) { - console.log('NOTE ERROR:', error); + const pSource = (global as any).source; + emitNet(events.NOTE_ACTION_RESULT, pSource, 'NOTES_DELETE_FAILED') } }); onNet(events.NOTE_UPDATE_NOTE, async (note: Note) => { - const _source = (global as any).source; try { + const pSource = (global as any).source; const _identifier = await useIdentifier(); - updateNote(note, _identifier); - emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, _source); + await updateNote(note, _identifier); + emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, pSource); + emitNet(events.NOTE_ACTION_RESULT, pSource, 'NOTES_UPDATE_SUCCESS') + } catch (error) { - emitNet(events.NOTE_UPDATE_NOTE_FAILURE, _source); + const pSource = (global as any).source; + emitNet(events.NOTE_UPDATE_NOTE_FAILURE, pSource); } }); + diff --git a/resources/utils/apps.ts b/resources/utils/apps.ts index 35a0726..ad74728 100644 --- a/resources/utils/apps.ts +++ b/resources/utils/apps.ts @@ -1,4 +1,5 @@ export default { TWITTER: 'TWITTER', MESSAGES: 'MESSAGES', + NOTES: 'NOTES' }; diff --git a/resources/utils/events.ts b/resources/utils/events.ts index 5bb8631..6cdc6fa 100644 --- a/resources/utils/events.ts +++ b/resources/utils/events.ts @@ -76,6 +76,8 @@ export default { NOTE_UPDATE_NOTE: 'phone:updateNote', NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess', NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure', + NOTE_ACTION_RESULT: 'phone:notesActionResult', + // DO NOT CHANGE WHATS BELOW, PLEASE - CHIP OPEN_APP_CONTACTS: 'phone:app:CONTACTS', diff --git a/resources/utils/messages.ts b/resources/utils/messages.ts index 088e771..4c79720 100644 --- a/resources/utils/messages.ts +++ b/resources/utils/messages.ts @@ -17,3 +17,7 @@ export function sendTwitterMessage(method: string, data: any = {}) { export function sendMessageEvent(method: string, data: any = {}) { return sendMessage(apps.MESSAGES, method, data); } + +export function sendNotesEvent(method: string, data: any = {}) { + return sendMessage(apps.NOTES, method, data); +} From 19a0ca73728d376b33cc8d9e4ceacece89312247 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 18:54:38 +0100 Subject: [PATCH 05/11] feat(more translation) --- phone/src/locale/en.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 0f0584e..953a6d6 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -84,6 +84,13 @@ "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar", "APPS_CONTACT_MODAL_BUTTON_ADD": "Add Contact", + "APPS_NOTES_ADD_SUCCESS": "Successfully saved note.", + "APPS_NOTES_ADD_FAILED": "Failed to save note.", + "APPS_NOTES_UPDATE_SUCCESS": "Successfully updated note.", + "APPS_NOTES_UPDATE_FAILED": "Failed to update note.", + "APPS_NOTES_DELETE_SUCCESS": "Successfully deleted note.", + "APPS_NOTES_DELETE_FAILED": "Failed to delete note.", + "APPS_SETTINGS_PHONE_NUMBER": "Phone Number", "APPS_SETTINGS_OPTION_WALLPAPER": "Wallpaper", "APPS_SETTINGS_OPTION_FRAME": "Frame", @@ -92,6 +99,7 @@ "APPS_SETTINGS_OPTION_RINGTONE": "Ringtone", "APPS_SETTINGS_OPTION_RINGTONEVOL": "Ringtone Volume", + "GENERIC_SAVE": "Save", "GENERIC_UPDATE": "Update", "GENERIC_DELETE": "Delete" } From 0502d03b242d36097152ccfa61fb1c713bbce304 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 20:31:43 +0100 Subject: [PATCH 06/11] feat(notes/nui): maxLength prop on title --- phone/src/apps/notes/modal/NoteModal.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index c3c3a42..af71684 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -70,6 +70,7 @@ export const NoteModal = () => { placeholder='Title' inputProps={{ className: classes.inputPropsTitle, + maxLength: 30 }} fullWidth value={title} From 8e207ea2b1405a2598896d654c36876f013718ce Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 20:56:24 +0100 Subject: [PATCH 07/11] fix(notes/nui): decreased NoteModal title maxLength --- phone/src/apps/notes/modal/NoteModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index af71684..8ab8e93 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -70,7 +70,7 @@ export const NoteModal = () => { placeholder='Title' inputProps={{ className: classes.inputPropsTitle, - maxLength: 30 + maxLength: 25 }} fullWidth value={title} From b57adf5a5653e6bf249d2a96574e7af23e70f166 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 21:15:12 +0100 Subject: [PATCH 08/11] fix(notes/nui): remmove NoteModal content and title on save --- phone/src/apps/notes/modal/NoteModal.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index 8ab8e93..7867d2a 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -22,28 +22,29 @@ export const NoteModal = () => { const _handleClose = () => { - setNoteModal(false); setDetail(null); + setNoteModal(false); }; const handleNoteSave = () => { - - setNoteModal(false); - setDetail(null); Nui.send('phone:addNote', { title, content, }); - setDetail(null) + setDetail(null); + setNoteModal(false); + + setTitle('') + setContent('') }; const handleDeleteNote = () => { const id = detail.id; - setNoteModal(false); Nui.send('phone:deleteNote', { id, }); setDetail(null); + setNoteModal(false); }; const handleUpdateNote = () => { @@ -52,8 +53,8 @@ export const NoteModal = () => { title, content, }); - setNoteModal(false); setDetail(null); + setNoteModal(false); }; return ( From 5e2b1a3aa5896c89f2ddec9a43b331466d664429 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 21:27:00 +0100 Subject: [PATCH 09/11] fix(notes/nui): fix Fab in notes list --- phone/src/apps/notes/NotesApp.tsx | 151 +++++++++++++++++++++++++++ phone/src/apps/notes/notes.styles.ts | 6 +- 2 files changed, 154 insertions(+), 3 deletions(-) diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx index c730344..f615923 100644 --- a/phone/src/apps/notes/NotesApp.tsx +++ b/phone/src/apps/notes/NotesApp.tsx @@ -32,6 +32,157 @@ InjectDebugData([ title: 'Second note', content: 'Hello, this is another shitty note', }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, + { + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + },{ + id: 2, + title: 'Second note', + content: 'Hello, this is another shitty note', + }, ], } ]); diff --git a/phone/src/apps/notes/notes.styles.ts b/phone/src/apps/notes/notes.styles.ts index c1b1cc5..9e07c84 100644 --- a/phone/src/apps/notes/notes.styles.ts +++ b/phone/src/apps/notes/notes.styles.ts @@ -21,9 +21,9 @@ const useStyles = makeStyles((theme) => ({ zIndex: 5, }, absolute: { - position: 'absolute', - bottom: theme.spacing(2), - right: theme.spacing(3), + position: 'sticky', + bottom: theme.spacing(3), + left: theme.spacing(40), }, })); From d4cf6ce4f6fa68bf199cf95ab23bd9f4e0e85291 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 21:27:27 +0100 Subject: [PATCH 10/11] fix(notes/nui): fix Fab in notes list --- phone/src/apps/notes/NotesApp.tsx | 151 ------------------------------ 1 file changed, 151 deletions(-) diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx index f615923..c730344 100644 --- a/phone/src/apps/notes/NotesApp.tsx +++ b/phone/src/apps/notes/NotesApp.tsx @@ -32,157 +32,6 @@ InjectDebugData([ title: 'Second note', content: 'Hello, this is another shitty note', }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, - { - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - },{ - id: 2, - title: 'Second note', - content: 'Hello, this is another shitty note', - }, ], } ]); From 1a5c85ed82cefcecefee7aed0163dbf4f414e86e Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 8 Feb 2021 21:29:43 +0100 Subject: [PATCH 11/11] fix(notes/nui): better solution for Fab --- phone/src/apps/notes/NotesApp.tsx | 4 ++-- phone/src/apps/notes/notes.styles.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx index c730344..8875d82 100644 --- a/phone/src/apps/notes/NotesApp.tsx +++ b/phone/src/apps/notes/NotesApp.tsx @@ -55,7 +55,8 @@ export const NotesApp = () => { - + { > - ); diff --git a/phone/src/apps/notes/notes.styles.ts b/phone/src/apps/notes/notes.styles.ts index 9e07c84..c1b1cc5 100644 --- a/phone/src/apps/notes/notes.styles.ts +++ b/phone/src/apps/notes/notes.styles.ts @@ -21,9 +21,9 @@ const useStyles = makeStyles((theme) => ({ zIndex: 5, }, absolute: { - position: 'sticky', - bottom: theme.spacing(3), - left: theme.spacing(40), + position: 'absolute', + bottom: theme.spacing(2), + right: theme.spacing(3), }, }));