mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
rendering contact sidebar
This commit is contained in:
parent
e912b47a6b
commit
f030b5ae1f
@ -3016,6 +3016,9 @@ components:
|
|||||||
- channel
|
- channel
|
||||||
- card
|
- card
|
||||||
properties:
|
properties:
|
||||||
|
account:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
profile:
|
profile:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
|
@ -12,10 +12,10 @@ function App() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<AppContextProvider>
|
<AppContextProvider>
|
||||||
<div style={{ width: '100%', height: '100vh', backgroundColor: '#8fbea7' }}>
|
<div style={{ position: 'absolute', width: '100vw', height: '100vh', backgroundColor: '#8fbea7' }}>
|
||||||
<img src={login} alt="" style={{ position: 'absolute', width: '33%', bottom: 0, right: 0 }}/>
|
<img src={login} alt="" style={{ position: 'absolute', width: '33%', bottom: 0, right: 0 }}/>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ position: 'absolute', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', top: 0, left: 0, width: '100%', height: '100%' }}>
|
<div style={{ position: 'absolute', width: '100vw', height: '100vh' }}>
|
||||||
<Router>
|
<Router>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={ <Home /> } />
|
<Route path="/" element={ <Home /> } />
|
||||||
|
@ -51,6 +51,7 @@ export function useAppContext() {
|
|||||||
const profileRevision = useRef(null);
|
const profileRevision = useRef(null);
|
||||||
|
|
||||||
const groups = useRef(new Map());
|
const groups = useRef(new Map());
|
||||||
|
const delay = useRef(2);
|
||||||
|
|
||||||
const ws = useRef(null);
|
const ws = useRef(null);
|
||||||
const revision = useRef(null);
|
const revision = useRef(null);
|
||||||
@ -69,7 +70,7 @@ export function useAppContext() {
|
|||||||
profileRevision.current = null;
|
profileRevision.current = null;
|
||||||
groupRevision.current = null;
|
groupRevision.current = null;
|
||||||
groups.current = new Map();
|
groups.current = new Map();
|
||||||
setState(null);
|
setState({});
|
||||||
}
|
}
|
||||||
|
|
||||||
const userActions = {
|
const userActions = {
|
||||||
@ -156,8 +157,9 @@ export function useAppContext() {
|
|||||||
ws.current.onopen = () => {}
|
ws.current.onopen = () => {}
|
||||||
ws.current.onerror = () => {}
|
ws.current.onerror = () => {}
|
||||||
setWebsocket(token);
|
setWebsocket(token);
|
||||||
|
delay.current += 1;
|
||||||
}
|
}
|
||||||
}, 2000)
|
}, delay.current * 1000)
|
||||||
}
|
}
|
||||||
ws.current.onopen = () => {
|
ws.current.onopen = () => {
|
||||||
ws.current.send(JSON.stringify({ AppToken: token }))
|
ws.current.send(JSON.stringify({ AppToken: token }))
|
||||||
|
@ -28,6 +28,9 @@ export const ProfileWrapper = styled.div`
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
@ -38,9 +41,9 @@ export const ProfileWrapper = styled.div`
|
|||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding: 1em;
|
padding: 32px;
|
||||||
margin-top: 32px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
overflow: scroll
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile {
|
.profile {
|
||||||
@ -64,7 +67,7 @@ export const ProfileWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
padding-right: 16px;
|
padding-right: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
@ -1,6 +1,30 @@
|
|||||||
import React from 'react'
|
import React, { useEffect } from 'react'
|
||||||
|
import { CardsWrapper } from './Cards.styled';
|
||||||
|
import { Drawer } from 'antd';
|
||||||
|
import { Registry } from './Registry/Registry';
|
||||||
|
|
||||||
export function Cards() {
|
export function Cards({ showRegistry }) {
|
||||||
return <div>CARDS</div>
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("HERE", showRegistry);
|
||||||
|
}, [showRegistry]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CardsWrapper>
|
||||||
|
|
||||||
|
<Drawer
|
||||||
|
placement="right"
|
||||||
|
closable={false}
|
||||||
|
visible={showRegistry}
|
||||||
|
getContainer={false}
|
||||||
|
contentWrapperStyle={{ width: '100%' }}
|
||||||
|
bodyStyle={{ padding: 0, backgroundColor: '#f6f5ed' }}
|
||||||
|
style={{ position: 'absolute' }}
|
||||||
|
>
|
||||||
|
<Registry />
|
||||||
|
</Drawer>
|
||||||
|
|
||||||
|
</CardsWrapper>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
net/web/src/User/SideBar/Contacts/Cards/Cards.styled.js
Normal file
12
net/web/src/User/SideBar/Contacts/Cards/Cards.styled.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Button } from 'antd';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
export const CardsWrapper = styled.div`
|
||||||
|
position: relative;
|
||||||
|
height: calc(100vh - 143px);
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 2px;
|
||||||
|
`;
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { RegistryWrapper } from './Registry.styled';
|
||||||
|
import { Input } from 'antd';
|
||||||
|
|
||||||
|
export function Registry() {
|
||||||
|
return (
|
||||||
|
<RegistryWrapper>
|
||||||
|
<Input.Search placeholder="Server" allowClear style={{ width: '100%' }} />
|
||||||
|
|
||||||
|
</RegistryWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
export const RegistryWrapper = styled.div`
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
text-align: center;
|
||||||
|
`;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { ChannelsWrapper } from './Channels.styled';
|
||||||
|
|
||||||
export function Channels() {
|
export function Channels() {
|
||||||
|
|
||||||
return <div>CHANNELS</div>
|
return <ChannelsWrapper />
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
export const ChannelsWrapper = styled.div`
|
||||||
|
position: relative;
|
||||||
|
height: calc(100vh - 143px);
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 2px;
|
||||||
|
`;
|
||||||
|
|
@ -1,25 +1,61 @@
|
|||||||
import { Avatar, Image } from 'antd';
|
import { Avatar, Image } from 'antd';
|
||||||
import React from 'react'
|
import React, { useState, useEffect, useRef } from 'react'
|
||||||
import { ContactsWrapper } from './Contacts.styled';
|
import { ContactsWrapper, AddButton } from './Contacts.styled';
|
||||||
import { useContacts } from './useContacts.hook';
|
import { useContacts } from './useContacts.hook';
|
||||||
import { Tabs } from 'antd';
|
import { Tabs, Button, Tooltip } from 'antd';
|
||||||
import { Cards } from './Cards/Cards';
|
import { Cards } from './Cards/Cards';
|
||||||
import { Channels } from './Channels/Channels';
|
import { Channels } from './Channels/Channels';
|
||||||
|
import { UserAddOutlined, CommentOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
export function Contacts() {
|
export function Contacts() {
|
||||||
|
|
||||||
const { state, actions } = useContacts()
|
const { state, actions } = useContacts()
|
||||||
|
const [addButton, setAddButton] = useState(<></>);
|
||||||
|
const [showRegistry, setShowRegistry] = useState(false);
|
||||||
|
let registry = useRef(false);
|
||||||
|
|
||||||
|
const onShowRegistry = () => {
|
||||||
|
registry.current = !registry.current;
|
||||||
|
setShowRegistry(registry.current);
|
||||||
|
}
|
||||||
|
|
||||||
|
const addUser = (
|
||||||
|
<Tooltip placement="bottomRight" title="Add Contact">
|
||||||
|
<AddButton type="primary" onClick={() => onShowRegistry()} icon={<UserAddOutlined />} />
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
|
||||||
|
const addConversation = (
|
||||||
|
<Tooltip placement="bottomRight" title="Add Conversation">
|
||||||
|
<AddButton type="primary" icon={<CommentOutlined />} />
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
|
||||||
|
const onTab = (key) => {
|
||||||
|
registry.current = false;
|
||||||
|
setShowRegistry(false);
|
||||||
|
if (key === "contact") {
|
||||||
|
setAddButton(addUser);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setAddButton(addConversation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setAddButton(addUser);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContactsWrapper>
|
<ContactsWrapper>
|
||||||
<Tabs defaultActiveKey="1">
|
<Tabs onChange={onTab} tabBarStyle={{ paddingLeft: 16, paddingRight: 16 }} tabBarExtraContent={addButton}>>
|
||||||
<TabPane tab="Contacts" key="1">
|
<TabPane tab="Contacts" key="contact">
|
||||||
<Cards />
|
<Cards showRegistry={showRegistry} />
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane tab="Conversations" key="2">
|
<TabPane tab="Conversations" key="conversation">
|
||||||
<Channels />
|
<Channels style={{ backgroundColor: 'red' }} />
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</ContactsWrapper>
|
</ContactsWrapper>
|
||||||
|
@ -2,8 +2,11 @@ import { Button } from 'antd';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
export const ContactsWrapper = styled.div`
|
export const ContactsWrapper = styled.div`
|
||||||
padding: 16px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex-grow: 1;
|
|
||||||
background-color: #f6f5ed;
|
background-color: #f6f5ed;
|
||||||
|
padding-top: 16px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const AddButton = styled(Button)`
|
||||||
|
border-radius: 8px;
|
||||||
`;
|
`;
|
||||||
|
@ -7,6 +7,4 @@ export const SideBarWrapper = styled.div`
|
|||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
border-right: 1px solid #8fbea7;
|
border-right: 1px solid #8fbea7;
|
||||||
background-color: #8fbea7;
|
background-color: #8fbea7;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user