mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
working profile and editing of profile
This commit is contained in:
1 parent
5072a31aab
commit
9fe4cf0188
27 files changed
+459
-51
No files matched your search
@@ -1,40 +1,31 @@
|
||||
import React, { useState, useCallback, useEffect } from "react";
|
||||
import { blue } from "@material-ui/core/colors";
|
||||
import { makeStyles, Button } from "@material-ui/core";
|
||||
import AddCircleIcon from "@material-ui/icons/AddCircle";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { makeStyles } from "@material-ui/core";
|
||||
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { AppLoader } from "../../../ui/components/AppLoader";
|
||||
import { useApp } from "../../../os/apps/hooks/useApps";
|
||||
import { useProfile } from "../hooks/useProfile";
|
||||
import TweetList from "./TweetList";
|
||||
import AddTweetModal from "./AddTweetModal";
|
||||
import { AppLoader } from "../../../ui/components/AppLoader";
|
||||
import TweetButton from "./TweetButton";
|
||||
import TwitterTitle from "./TwitterTitle";
|
||||
import BottomNavigation from "./BottomNavigation";
|
||||
import TwitterProfile from "./profile/TwitterProfile";
|
||||
import { useProfile } from "../hooks/useProfile";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
height: "90px",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
backgroundColor: blue[600],
|
||||
alignItems: "center",
|
||||
},
|
||||
header: {
|
||||
fontFamily: "'Bebas Neue', cursive",
|
||||
textAlign: "center",
|
||||
fontSize: 50,
|
||||
},
|
||||
}));
|
||||
import "./twitter.css";
|
||||
|
||||
const PAGE_COMPONENT_MAPPING = {
|
||||
0: <TweetList />,
|
||||
1: <TweetList />,
|
||||
2: <TwitterProfile />,
|
||||
};
|
||||
const MINIMUM_LOAD_TIME = 750;
|
||||
|
||||
export const TwitterApp = () => {
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [minimumLoadPassed, setMimimumLoadPassed] = useState(false);
|
||||
const classes = useStyles();
|
||||
const twitter = useApp("TWITTER");
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [activePage, setActivePage] = useState(2);
|
||||
const { profile } = useProfile();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -50,32 +41,33 @@ export const TwitterApp = () => {
|
||||
|
||||
const openModal = () => setModalVisible(true);
|
||||
const hideModal = () => setModalVisible(false);
|
||||
const handlePageChange = (e, page) => setActivePage(page);
|
||||
|
||||
// we add a minimum (but short) load time here so that
|
||||
// there isn't a quick flash of loading and immediately
|
||||
// another flash to the tweets screen.
|
||||
const hasLoaded = profile && minimumLoadPassed;
|
||||
const showTweetButton = hasLoaded && activePage === 0;
|
||||
const component = hasLoaded ? (
|
||||
PAGE_COMPONENT_MAPPING[activePage]
|
||||
) : (
|
||||
<AppLoader />
|
||||
);
|
||||
|
||||
return (
|
||||
<AppWrapper>
|
||||
<AppTitle app={twitter} className={classes.root} />
|
||||
<Button
|
||||
onClick={openModal}
|
||||
variant="contained"
|
||||
style={{ backgroundColor: "#232323" }}
|
||||
>
|
||||
<AddCircleIcon color="action" />
|
||||
</Button>
|
||||
<TwitterTitle />
|
||||
<AppContent>
|
||||
{hasLoaded ? (
|
||||
<>
|
||||
<AddTweetModal visible={modalVisible} handleClose={hideModal} />
|
||||
<TweetList />
|
||||
</>
|
||||
) : (
|
||||
<AppLoader />
|
||||
)}
|
||||
<div id="twitter-content">
|
||||
<AddTweetModal visible={modalVisible} handleClose={hideModal} />
|
||||
{component}
|
||||
</div>
|
||||
</AppContent>
|
||||
{showTweetButton && <TweetButton openModal={openModal} />}
|
||||
<BottomNavigation
|
||||
activePage={activePage}
|
||||
handleChange={handlePageChange}
|
||||
/>
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user