mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Merge branch 'ui-changes'
This commit is contained in:
commit
f3af0eebd4
29 files changed
+400
-248
No files matched your search
@@ -1,23 +1,25 @@
|
||||
import React from "react";
|
||||
import { AppWrapper } from "../../ui/components/AppWrapper";
|
||||
import { AppContent } from "../../ui/components/AppContent";
|
||||
import NotesTitle from "./NotesTitle";
|
||||
import NoteList from "./list/NoteList";
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../ui/components/AppWrapper';
|
||||
import { AppContent } from '../../ui/components/AppContent';
|
||||
import { AppTitle } from '../../ui/components/AppTitle';
|
||||
import { useApp } from '../../os/apps/hooks/useApps';
|
||||
import NoteList from './list/NoteList';
|
||||
|
||||
import { useNotes } from "./hooks/useNotes";
|
||||
import { NoteModal } from "./modal/NoteModal";
|
||||
import { Fab } from "@material-ui/core";
|
||||
import AddIcon from "@material-ui/icons/Add";
|
||||
import { useNotes } from './hooks/useNotes';
|
||||
import { NoteModal } from './modal/NoteModal';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
|
||||
import { useNoteModal } from "./hooks/useNoteModal";
|
||||
import { useNoteDetail } from "./hooks/useNoteDetail";
|
||||
import { useNoteModal } from './hooks/useNoteModal';
|
||||
import { useNoteDetail } from './hooks/useNoteDetail';
|
||||
|
||||
import useStyles from "./notes.styles";
|
||||
import useStyles from './notes.styles';
|
||||
|
||||
export const NotesApp = () => {
|
||||
const { setNoteModal } = useNoteModal();
|
||||
const { detail, setDetail } = useNoteDetail();
|
||||
const notes = useNotes();
|
||||
const notesApp = useApp('NOTES');
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
@@ -27,8 +29,8 @@ export const NotesApp = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<AppWrapper id="notes-app">
|
||||
<NotesTitle />
|
||||
<AppWrapper id='notes-app'>
|
||||
<AppTitle app={notesApp} />
|
||||
<NoteModal key={detail?.id} />
|
||||
<AppContent>
|
||||
<NoteList notes={notes} />
|
||||
@@ -36,8 +38,8 @@ export const NotesApp = () => {
|
||||
className={classes.absolute}
|
||||
onClick={handleModal}
|
||||
style={{
|
||||
background: "#f9a825",
|
||||
color: "#fff",
|
||||
background: '#f9a825',
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
<AddIcon />
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
import { List, ListItem, ListItemText } from '@material-ui/core';
|
||||
import React, { useState } from 'react'
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { useNoteModal } from '../hooks/useNoteModal';
|
||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||
|
||||
// add search bar later
|
||||
const NoteList = ({notes}) => {
|
||||
// TODO: Add interface for note
|
||||
const NoteList = ({ notes }) => {
|
||||
const { setNoteModal } = useNoteModal();
|
||||
const { setDetail } = useNoteDetail();
|
||||
|
||||
const handleNoteModal = (note) => {
|
||||
setNoteModal(true)
|
||||
setDetail(note)
|
||||
}
|
||||
setNoteModal(true);
|
||||
setDetail(note);
|
||||
};
|
||||
|
||||
return (
|
||||
<List>
|
||||
<List disablePadding>
|
||||
{notes.map((note) => (
|
||||
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
|
||||
<ListItemText><strong>{note.title}</strong></ListItemText>
|
||||
<ListItem
|
||||
key={note.id}
|
||||
button
|
||||
divider
|
||||
onClick={() => handleNoteModal(note)}
|
||||
>
|
||||
<ListItemText>{note.title}</ListItemText>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default NoteList;
|
||||
@@ -1,25 +1,22 @@
|
||||
import {
|
||||
Button,
|
||||
TextField,
|
||||
Slide,
|
||||
} from "@material-ui/core";
|
||||
import React, { useState } from "react";
|
||||
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
|
||||
import { Button, TextField, Slide } from '@material-ui/core';
|
||||
import React, { useState } from 'react';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
|
||||
import { useNoteModal } from "../hooks/useNoteModal";
|
||||
import { useNoteDetail } from "../hooks/useNoteDetail";
|
||||
import { useNoteModal } from '../hooks/useNoteModal';
|
||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||
|
||||
import useStyles from "./modal.styles";
|
||||
import useStyles from './modal.styles';
|
||||
|
||||
import "../NotesApp.css";
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import '../NotesApp.css';
|
||||
import Nui from '../../../os/nui-events/utils/Nui';
|
||||
|
||||
// TODO: Fix input focus color
|
||||
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 [title, setTitle] = useState(detail ? detail.title : '');
|
||||
const [content, setContent] = useState(detail ? detail.content : '');
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
@@ -31,7 +28,7 @@ export const NoteModal = () => {
|
||||
const handleNoteSave = () => {
|
||||
setNoteModal(false);
|
||||
setDetail(null);
|
||||
Nui.send("phone:addNote", {
|
||||
Nui.send('phone:addNote', {
|
||||
title,
|
||||
content,
|
||||
});
|
||||
@@ -40,14 +37,14 @@ export const NoteModal = () => {
|
||||
const handleDeleteNote = () => {
|
||||
const id = detail.id;
|
||||
setNoteModal(false);
|
||||
Nui.send("phone:deleteNote", {
|
||||
Nui.send('phone:deleteNote', {
|
||||
id,
|
||||
});
|
||||
setDetail(null);
|
||||
};
|
||||
|
||||
const handleUpdateNote = () => {
|
||||
Nui.send("phone:updateNote", {
|
||||
Nui.send('phone:updateNote', {
|
||||
id: detail.id,
|
||||
title,
|
||||
content,
|
||||
@@ -58,15 +55,15 @@ export const NoteModal = () => {
|
||||
|
||||
return (
|
||||
<div className={noteModal ? classes.modalRoot : classes.modalHide}>
|
||||
<Slide direction="left" in={noteModal} mountOnEnter unmountOnExit>
|
||||
<Slide direction='left' in={noteModal} mountOnEnter unmountOnExit>
|
||||
<div>
|
||||
<Button className={classes.closeButton} onClick={_handleClose}>
|
||||
<ArrowBackIcon fontSize="large" />
|
||||
</Button>
|
||||
<div id="notes-modal" className={classes.noteContainer}>
|
||||
<div id='notes-modal' className={classes.noteContainer}>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder="Title"
|
||||
placeholder='Title'
|
||||
inputProps={{
|
||||
className: classes.inputPropsTitle,
|
||||
}}
|
||||
@@ -79,11 +76,11 @@ export const NoteModal = () => {
|
||||
inputProps={{
|
||||
className: classes.inputPropsContent,
|
||||
}}
|
||||
placeholder="Content"
|
||||
placeholder='Content'
|
||||
multiline
|
||||
fullWidth
|
||||
rows={19}
|
||||
variant="outlined"
|
||||
variant='outlined'
|
||||
value={content}
|
||||
onChange={(e) => setContent(e.target.value)}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user