diff --git a/bfrontend/src/Components/Channels/ChannelMessageView.js b/bfrontend/src/Components/Channels/ChannelMessageView.js index f9c7f4d..d4c3a87 100644 --- a/bfrontend/src/Components/Channels/ChannelMessageView.js +++ b/bfrontend/src/Components/Channels/ChannelMessageView.js @@ -1,5 +1,6 @@ import Message from "../Messages/Message"; import { useRef, useEffect } from 'react'; +import { CommentDiscussionIcon } from "@primer/octicons-react"; export default function ChannelMessageView({messages}) { const invisibleBottomMessageRef = useRef(); @@ -11,7 +12,8 @@ export default function ChannelMessageView({messages}) { let messagesView = messages.map((message) => ()); if (messagesView === undefined || messagesView.length <= 0) messagesView = (
- No messages yet... + + No messages yet...
); return
diff --git a/bfrontend/src/Components/Channels/ChannelProfileLink.js b/bfrontend/src/Components/Channels/ChannelProfileLink.js index bc7aba3..6b2bdf3 100644 --- a/bfrontend/src/Components/Channels/ChannelProfileLink.js +++ b/bfrontend/src/Components/Channels/ChannelProfileLink.js @@ -1,8 +1,17 @@ -import ProfileLink from '../UI/ProfileLink' +export default function ChannelProfileLink({ channel, size }) { + let picture = null; + + if (size !== "0") { + if (channel.picture) picture = Profile + else picture =
+ # +
+ } -// TODO: Stop using this component and just use the ProfileLink component -export default function ChannelProfile({ channel, size, offset=false }) { return ( - +
+ { picture } + { channel.title } +
); -} \ No newline at end of file +}; diff --git a/bfrontend/src/Components/Main/App.js b/bfrontend/src/Components/Main/App.js index 69e7a9a..d0b7fae 100644 --- a/bfrontend/src/Components/Main/App.js +++ b/bfrontend/src/Components/Main/App.js @@ -35,7 +35,10 @@ function App({ user }) { - } + /> + } /> diff --git a/bfrontend/src/Components/Main/LoggedInMount.js b/bfrontend/src/Components/Main/LoggedInMount.js index c7e693d..29dac24 100644 --- a/bfrontend/src/Components/Main/LoggedInMount.js +++ b/bfrontend/src/Components/Main/LoggedInMount.js @@ -2,15 +2,17 @@ import { useParams } from "react-router-dom"; import Sidebar from "../UI/Sidebar"; import ChannelView from "../Channels/ChannelView"; import GradientBanner from "../UI/GradientBanner"; +import UserView from "../Users/UserView"; import { connect } from "react-redux"; function LoggedInMount({ gradientBannerNotificationText }) { - const { id: channelId } = useParams(); + const { channelId, userId } = useParams(); return <>
{ (channelId) && } + { (userId) && }
; } diff --git a/bfrontend/src/Components/UI/ProfileLink.js b/bfrontend/src/Components/UI/ProfileLink.js deleted file mode 100644 index 599ff67..0000000 --- a/bfrontend/src/Components/UI/ProfileLink.js +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: This is an actual, horrible mess -export default function ProfileLink({ object, size, type, offset=true, children=null, hideName=false }) { - let picture; - - if (size !== "0") { - // TODO: Make a debug error message for then the size does not exist - const pictureClass = `profile-picture profile-picture-${size}`; - - if (object.picture) { - // Not actually implemented on the server and can be unsafe, this is just futureproofing - picture = Profile - } else { - picture =
- { (type === "user") ? "@" : "#" } -
- } - } else { - picture = null; - } - - let classes = offset ? 'profile-link profile-link-offset-text' : 'profile-link'; - if (type === "user") classes += " darker-text"; - const title = type === 'channel' ? object.title : object.username; - const bottomInfo = offset ? children : null; - - return ( -
- { picture } - { title } - { bottomInfo } -
- ); -}; \ No newline at end of file diff --git a/bfrontend/src/Components/Users/UserProfileLink.js b/bfrontend/src/Components/Users/UserProfileLink.js index e509ef6..1b3a4e1 100644 --- a/bfrontend/src/Components/Users/UserProfileLink.js +++ b/bfrontend/src/Components/Users/UserProfileLink.js @@ -1,8 +1,17 @@ -import ProfileLink from '../UI/ProfileLink' +export default function UserProfileLink({ user, size }) { + let picture = null; + + if (size !== "0") { + if (user.picture) picture = Profile + else picture =
+ @ +
+ } -// TODO: Stop using this component and just use the ProfileLink component -export default function UserProfile({ user, size, subtext, hideName }) { return ( - { subtext }) } /> +
+ { picture } + { user.username } +
); -} \ No newline at end of file +}; diff --git a/bfrontend/src/Components/Users/UserView.js b/bfrontend/src/Components/Users/UserView.js new file mode 100644 index 0000000..48cd74a --- /dev/null +++ b/bfrontend/src/Components/Users/UserView.js @@ -0,0 +1,43 @@ +import { useEffect, useState } from "react"; +import { PersonIcon, ShieldCheckIcon } from "@primer/octicons-react"; +import APIRequest from "../../API/APIRequest"; +import UserProfile from "./UserProfileLink"; +import ProfileLinkLoader from "../UI/ProfileLinkLoader"; + +export default function UserView({ userId }) { + const [userObject, setUserObject] = useState(null); + + useEffect(() => { + APIRequest.authenticated(`/api/v1/users/user/${userId}/info`, { + method: 'GET', + headers: { + "Accept": "application/json" + } + }).then(({ isOK, json }) => { + if (isOK) { + setUserObject(json.user); + } + }); + }, [userId]); + + let view = null; + if (userObject) { + view = <> + + {(userObject.role === "ADMIN") && } + {(userObject.role === "USER") && } + + } else { + view = <> + + + } + + return ( +
+
+ {view} +
+
+ ); +} \ No newline at end of file diff --git a/bfrontend/src/Styles/Components/Card.scss b/bfrontend/src/Styles/Components/Card.scss index abac853..d0da9f2 100644 --- a/bfrontend/src/Styles/Components/Card.scss +++ b/bfrontend/src/Styles/Components/Card.scss @@ -64,4 +64,17 @@ text-overflow: ellipsis; white-space: nowrap; cursor: default; +} + +.elevated-modal { + @extend .elevated-2; + + background-color: var(--card-accent-color-dark); + padding: 16px; + margin: 6px; + border-radius: var(--elevated-modal-border-radius); +} + +.user-view { + @extend .elevated-modal; } \ No newline at end of file diff --git a/bfrontend/src/Styles/Components/Containers.scss b/bfrontend/src/Styles/Components/Containers.scss index a2b6890..6bb903b 100644 --- a/bfrontend/src/Styles/Components/Containers.scss +++ b/bfrontend/src/Styles/Components/Containers.scss @@ -53,4 +53,18 @@ .messages-scroll-div { height: 18px; visibility: hidden; +} + +.center { + display: flex; + justify-content: center; + align-items: center; +} + +.grow { + flex-grow: 1; +} + +.profile-badge { + margin: 16px; } \ No newline at end of file diff --git a/bfrontend/src/Styles/Components/ProfileLink.scss b/bfrontend/src/Styles/Components/ProfileLink.scss index 447fd83..e36b8d4 100644 --- a/bfrontend/src/Styles/Components/ProfileLink.scss +++ b/bfrontend/src/Styles/Components/ProfileLink.scss @@ -1,10 +1,9 @@ .profile-picture { border-radius: 50%; flex-shrink: 0; - margin: 5px; + margin: 6px; width: 32px; height: 32px; - margin-right: 6px; &.default-channel { border-radius: 12px; diff --git a/bfrontend/src/Styles/Components/properties.scss b/bfrontend/src/Styles/Components/properties.scss index e9572a5..5692fa9 100644 --- a/bfrontend/src/Styles/Components/properties.scss +++ b/bfrontend/src/Styles/Components/properties.scss @@ -1,3 +1,7 @@ .elevated { box-shadow: var(--elevation-box-shadow); +} + +.elevated-2 { + box-shadow: rgba(0, 0, 0, 0.50) 0px 25px 50px -4px; } \ No newline at end of file diff --git a/bfrontend/src/Styles/root.scss b/bfrontend/src/Styles/root.scss index c866f69..ae10af9 100644 --- a/bfrontend/src/Styles/root.scss +++ b/bfrontend/src/Styles/root.scss @@ -2,8 +2,8 @@ --background-color: hsl(230, 12%, 15%); --card-accent-color: hsl(230, 12%, 18%); --card-accent-color-dark: hsl(230, 12%, 12%); - --default-text-color: hsl(0, 0%, 79%); - --darker-text-color: hsl(0, 0%, 53%); + --default-text-color: hsl(0, 0%, 80%); + --darker-text-color: hsl(0, 0%, 65%); --default-user-background: linear-gradient( to bottom right, @@ -18,6 +18,8 @@ hsl(225, 35%, 40%) ); + --elevated-modal-border-radius: 10px; + --default-scrollbar-color: var(--card-accent-color); --default-scrollbar-color-track: var(--background-color); --default-scrollbar-width: 1px;