mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
Update: Work on new Friends tab + minor fixes
This commit is contained in:
parent
82b8a9b28e
commit
4d9d74224f
12 changed files with 128 additions and 67 deletions
|
@ -4,7 +4,7 @@ import styled, { css } from "styled-components";
|
||||||
import { useSelf } from "../../context/revoltjs/hooks";
|
import { useSelf } from "../../context/revoltjs/hooks";
|
||||||
import { useHistory, useLocation } from "react-router";
|
import { useHistory, useLocation } from "react-router";
|
||||||
import ConditionalLink from "../../lib/ConditionalLink";
|
import ConditionalLink from "../../lib/ConditionalLink";
|
||||||
import { MessageRounded, Group } from "@styled-icons/boxicons-regular";
|
import { Message, Group } from "@styled-icons/boxicons-regular";
|
||||||
|
|
||||||
const NavigationBase = styled.div`
|
const NavigationBase = styled.div`
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
@ -50,7 +50,7 @@ export default function BottomNavigation() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<MessageRounded size={26} />
|
<Message size={26} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Button>
|
</Button>
|
||||||
<Button active={friendsActive}>
|
<Button active={friendsActive}>
|
||||||
|
|
|
@ -41,9 +41,7 @@ export function UserButton({ active, alert, alertCount, user, context, channel }
|
||||||
unread: alert,
|
unread: alert,
|
||||||
contextualChannel: context?._id
|
contextualChannel: context?._id
|
||||||
})}>
|
})}>
|
||||||
<div className={styles.avatar}>
|
<UserIcon className={styles.avatar} target={user} size={32} status />
|
||||||
<UserIcon target={user} size={32} status />
|
|
||||||
</div>
|
|
||||||
<div className={styles.name}>
|
<div className={styles.name}>
|
||||||
<div>{user.username}</div>
|
<div>{user.username}</div>
|
||||||
{
|
{
|
||||||
|
@ -99,11 +97,10 @@ export function ChannelButton({ active, alert, alertCount, channel, user, compac
|
||||||
return (
|
return (
|
||||||
<div data-active={active}
|
<div data-active={active}
|
||||||
data-alert={typeof alert === 'string'}
|
data-alert={typeof alert === 'string'}
|
||||||
|
aria-label={{}} /*TOFIX: ADD ARIA LABEL*/
|
||||||
className={classNames(styles.item, { [styles.compact]: compact })}
|
className={classNames(styles.item, { [styles.compact]: compact })}
|
||||||
onContextMenu={attachContextMenu('Menu', { channel: channel._id, unread: typeof channel.unread !== 'undefined' })}>
|
onContextMenu={attachContextMenu('Menu', { channel: channel._id, unread: typeof channel.unread !== 'undefined' })}>
|
||||||
<div className={styles.avatar}>
|
<ChannelIcon className={styles.avatar} target={channel} size={compact ? 24 : 32} />
|
||||||
<ChannelIcon target={channel} size={compact ? 24 : 32} />
|
|
||||||
</div>
|
|
||||||
<div className={styles.name}>
|
<div className={styles.name}>
|
||||||
<div>{channel.name}</div>
|
<div>{channel.name}</div>
|
||||||
{ channel.channel_type === 'Group' &&
|
{ channel.channel_type === 'Group' &&
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.item {
|
.item {
|
||||||
height: 48px;
|
height: 42px;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
&.user {
|
&.user {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: .15s ease opacity;
|
transition: .1s ease-in-out opacity;
|
||||||
|
|
||||||
&[data-online="true"],
|
&[data-online="true"],
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
@ -111,7 +111,7 @@ const ServerEntry = styled.div<{ active: boolean, home?: boolean }>`
|
||||||
height: 46px;
|
height: 46px;
|
||||||
|
|
||||||
${ props => props.active && css`
|
${ props => props.active && css`
|
||||||
background: var(--sidebar-active);
|
background-color: var(--sidebar-active);
|
||||||
|
|
||||||
&::before, &::after {
|
&::before, &::after {
|
||||||
// outline: 1px solid blue;
|
// outline: 1px solid blue;
|
||||||
|
@ -128,7 +128,7 @@ const ServerEntry = styled.div<{ active: boolean, home?: boolean }>`
|
||||||
margin-left: -25px;
|
margin-left: -25px;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|
||||||
background: var(--background);
|
background-color: var(--background);
|
||||||
border-bottom-right-radius: 32px;
|
border-bottom-right-radius: 32px;
|
||||||
|
|
||||||
box-shadow: 0 32px 0 0 var(--sidebar-active);
|
box-shadow: 0 32px 0 0 var(--sidebar-active);
|
||||||
|
|
|
@ -11,10 +11,13 @@ export default styled.div<Props>`
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
flex: 0 auto;
|
flex: 0 auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 20px;
|
padding: 0 20px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
@ -22,6 +25,10 @@ export default styled.div<Props>`
|
||||||
background-size: cover !important;
|
background-size: cover !important;
|
||||||
background-position: center !important;
|
background-position: center !important;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
${ props => props.background && css`
|
${ props => props.background && css`
|
||||||
height: 120px;
|
height: 120px;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
|
|
@ -42,6 +42,8 @@ const ModalContainer = styled.div`
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
max-width: calc(100vw - 20px);
|
max-width: calc(100vw - 20px);
|
||||||
|
|
||||||
|
inline-size: min(100%, 500px);
|
||||||
|
|
||||||
animation-name: ${zoomIn};
|
animation-name: ${zoomIn};
|
||||||
animation-duration: 0.25s;
|
animation-duration: 0.25s;
|
||||||
animation-timing-function: cubic-bezier(.3,.3,.18,1.1);
|
animation-timing-function: cubic-bezier(.3,.3,.18,1.1);
|
||||||
|
|
|
@ -22,6 +22,10 @@ const Info = styled.div`
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
* {
|
* {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
user-select: none;
|
user-select: none;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
.overline {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
&[data-empty="true"] {
|
&[data-empty="true"] {
|
||||||
img {
|
img {
|
||||||
height: 120px;
|
height: 120px;
|
||||||
|
@ -41,14 +45,21 @@
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
span {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
.subtext {
|
.subtext {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--tertiary-foreground);
|
color: var(--tertiary-foreground);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +68,16 @@
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
height: 32px;
|
height: 40px;
|
||||||
width: 32px;
|
width: 40px;
|
||||||
|
|
||||||
|
&:nth-child(1):hover {
|
||||||
|
background: var(--status-online); //TOFIX: change to normal green color
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(3):hover {
|
||||||
|
background: var(--error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { Link } from "react-router-dom";
|
||||||
import styles from "./Friend.module.scss";
|
import styles from "./Friend.module.scss";
|
||||||
import { useContext } from "preact/hooks";
|
import { useContext } from "preact/hooks";
|
||||||
import { Children } from "../../types/Preact";
|
import { Children } from "../../types/Preact";
|
||||||
import { X, Plus, Envelope } from "@styled-icons/boxicons-regular";
|
import { X, Plus } from "@styled-icons/boxicons-regular";
|
||||||
|
import { PhoneCall, Envelope } from "@styled-icons/boxicons-solid";
|
||||||
import IconButton from "../../components/ui/IconButton";
|
import IconButton from "../../components/ui/IconButton";
|
||||||
import { attachContextMenu } from "preact-context-menu";
|
import { attachContextMenu } from "preact-context-menu";
|
||||||
import { User, Users } from "revolt.js/dist/api/objects";
|
import { User, Users } from "revolt.js/dist/api/objects";
|
||||||
|
@ -27,12 +28,20 @@ export function Friend({ user }: Props) {
|
||||||
if (user.relationship === Users.Relationship.Friend) {
|
if (user.relationship === Users.Relationship.Friend) {
|
||||||
subtext = <UserStatus user={user} />
|
subtext = <UserStatus user={user} />
|
||||||
actions.push(
|
actions.push(
|
||||||
|
<>
|
||||||
|
<IconButton type="circle"
|
||||||
|
onClick={stopPropagation}>
|
||||||
|
<Link to={'/open/' + user._id}>
|
||||||
|
<PhoneCall size={20} />
|
||||||
|
</Link>
|
||||||
|
</IconButton>
|
||||||
<IconButton type="circle"
|
<IconButton type="circle"
|
||||||
onClick={stopPropagation}>
|
onClick={stopPropagation}>
|
||||||
<Link to={'/open/' + user._id}>
|
<Link to={'/open/' + user._id}>
|
||||||
<Envelope size={20} />
|
<Envelope size={20} />
|
||||||
</Link>
|
</Link>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +86,7 @@ export function Friend({ user }: Props) {
|
||||||
<div className={styles.friend}
|
<div className={styles.friend}
|
||||||
onClick={() => openScreen({ id: 'profile', user_id: user._id })}
|
onClick={() => openScreen({ id: 'profile', user_id: user._id })}
|
||||||
onContextMenu={attachContextMenu('Menu', { user: user._id })}>
|
onContextMenu={attachContextMenu('Menu', { user: user._id })}>
|
||||||
<UserIcon target={user} size={32} status />
|
<UserIcon target={user} size={38} status />
|
||||||
<div className={styles.name}>
|
<div className={styles.name}>
|
||||||
<span>@{user.username}</span>
|
<span>@{user.username}</span>
|
||||||
{subtext && (
|
{subtext && (
|
||||||
|
|
|
@ -76,3 +76,17 @@
|
||||||
background: var(--secondary-background);
|
background: var(--secondary-background);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.roles {
|
||||||
|
.overview {
|
||||||
|
height: 85vh; //TOFIX change later
|
||||||
|
display: flex;
|
||||||
|
.list {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
import Tip from "../../../components/ui/Tip";
|
import Tip from "../../../components/ui/Tip";
|
||||||
|
import styles from './Panes.module.scss';
|
||||||
import Button from "../../../components/ui/Button";
|
import Button from "../../../components/ui/Button";
|
||||||
import { Servers } from "revolt.js/dist/api/objects";
|
import { Servers } from "revolt.js/dist/api/objects";
|
||||||
import InputBox from "../../../components/ui/InputBox";
|
import InputBox from "../../../components/ui/InputBox";
|
||||||
|
@ -6,6 +7,7 @@ import Checkbox from "../../../components/ui/Checkbox";
|
||||||
import { useContext, useEffect, useState } from "preact/hooks";
|
import { useContext, useEffect, useState } from "preact/hooks";
|
||||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
import { ChannelPermission, ServerPermission } from "revolt.js/dist/api/permissions";
|
import { ChannelPermission, ServerPermission } from "revolt.js/dist/api/permissions";
|
||||||
|
import { Styleshare } from "@styled-icons/simple-icons";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
server: Servers.Server;
|
server: Servers.Server;
|
||||||
|
@ -42,8 +44,10 @@ export function Roles({ server }: Props) {
|
||||||
const [ name, setName ] = useState('');
|
const [ name, setName ] = useState('');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={styles.roles}>
|
||||||
<Tip warning>This section is under construction.</Tip>
|
<Tip warning>This section is under construction.</Tip>
|
||||||
|
<div className={styles.overview}>
|
||||||
|
<div className={styles.list}>
|
||||||
<h2>select role</h2>
|
<h2>select role</h2>
|
||||||
{ selected }
|
{ selected }
|
||||||
{ keys
|
{ keys
|
||||||
|
@ -65,6 +69,8 @@ export function Roles({ server }: Props) {
|
||||||
<Button contrast onClick={() => {
|
<Button contrast onClick={() => {
|
||||||
client.servers.createRole(server._id, name);
|
client.servers.createRole(server._id, name);
|
||||||
}}>create</Button>
|
}}>create</Button>
|
||||||
|
</div>
|
||||||
|
<div className={styles.permissions}>
|
||||||
<h2>serverm permmissions</h2>
|
<h2>serverm permmissions</h2>
|
||||||
{ Object.keys(ServerPermission)
|
{ Object.keys(ServerPermission)
|
||||||
.map(perm => {
|
.map(perm => {
|
||||||
|
@ -93,5 +99,8 @@ export function Roles({ server }: Props) {
|
||||||
client.servers.setPermissions(server._id, selected, { server: p[0], channel: p[1] });
|
client.servers.setPermissions(server._id, selected, { server: p[0], channel: p[1] });
|
||||||
}}>click here to save permissions for role</Button>
|
}}>click here to save permissions for role</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.preact-context-menu .context-menu {
|
.preact-context-menu .context-menu {
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
min-width: 180px;
|
min-width: 190px;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
Loading…
Reference in a new issue