mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
I really hope I didnt fuck anything up now
This commit is contained in:
1 parent
ad20755608
commit
ec37fcde46
67 files changed
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import { Button } from "@material-ui/core";
|
||||
|
||||
import PhoneIcon from "@material-ui/icons/Phone";
|
||||
import ChatIcon from "@material-ui/icons/Chat";
|
||||
import { List } from "../../../ui/components/List";
|
||||
import { ListItem } from "../../../ui/components/ListItem";
|
||||
|
||||
export const ContactList = ({ contacts, onCall, onMessage }) => {
|
||||
return (
|
||||
<List>
|
||||
{contacts.map((contact) => (
|
||||
<ListItem key={contact.id} divider>
|
||||
<ListItemText
|
||||
primary={contact.display}
|
||||
secondary={contact.phoneNumber}
|
||||
/>
|
||||
<Button onClick={() => onCall(contact.display)}>
|
||||
<PhoneIcon />
|
||||
</Button>
|
||||
<Button onClick={onMessage}>
|
||||
<ChatIcon />
|
||||
</Button>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
import React from "react";
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useContacts } from "../hooks/useContacts";
|
||||
import { ContactList } from "./ContactList";
|
||||
import { useApps } from "../../appmarket/hooks/useApps";
|
||||
|
||||
export const ContactsApp = () => {
|
||||
const { contactList } = useContacts();
|
||||
const { getApp } = useApps();
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<AppWrapper>
|
||||
<AppTitle color={getApp("contacts").backgroundColor}>
|
||||
{t("APPS_CONTACTS")}
|
||||
</AppTitle>
|
||||
<AppContent>
|
||||
<ContactList
|
||||
contacts={contactList}
|
||||
onCall={(contact => console.log(contact))}
|
||||
onMessage={() => console.log("Opening messages")}
|
||||
/>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
import { useRecoilState, atom } from "recoil";
|
||||
|
||||
const contactListState = atom({
|
||||
key: "contactList",
|
||||
default: [
|
||||
{
|
||||
id: 0,
|
||||
display: "Test Contact",
|
||||
phoneNumber: "000-1111",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
display: "Test Contact 2",
|
||||
phoneNumber: "000-1112",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const useContacts = () => {
|
||||
const [contactList, setContactList] = useRecoilState(contactListState);
|
||||
return { contactList, setContactList };
|
||||
};
|
||||
Reference in new issue
Block a user