Skip to content

Commit

Permalink
rfac: workspace-view
Browse files Browse the repository at this point in the history
  • Loading branch information
yp969803 committed Feb 16, 2024
1 parent f756b4d commit 416af5d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/components/timeRangeSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TimeRangeSwitch: React.FC<Props> = ({ weekly, setWeekly }) => {
// const dispatch = useDispatch();
// const isWeekly = useSelector((state: timeRangeModel) => state.isWeekly.value);
useEffect(()=>{
console.log(weekly,"makki")

},[weekly, setWeekly])
return (
<div className='timerange-cont'>
Expand Down
5 changes: 5 additions & 0 deletions src/app/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ a:hover {
.bd-white {
border: 1px solid white;
}


.pointer{
cursor: pointer;
}
2 changes: 2 additions & 0 deletions src/features/workspace-view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const WorkspaceView = () => {
const [isLoad, setIsLoad] = useState<boolean>(false);
const [archeives, setArcheives] = useState<boolean>(false);
const token = localStorage.getItem('token');
const [orgs, setOrgs] = useState<UserOrgDetails[]>();
const navigate = useNavigate();
const fetchData = async () => {
if (token && userContext?.username) {
Expand All @@ -25,6 +26,7 @@ const WorkspaceView = () => {
userContext?.username.toString()
);
userContext?.setUserOrgs(userOrgs.data);

} catch (e) {}

setIsLoad(false);
Expand Down
15 changes: 8 additions & 7 deletions src/features/workspace-view/workspace-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type workspaceCardProps = {
bookmark: boolean;
archeives: boolean;
};

interface members {
[username: string]: string;
}
Expand All @@ -31,7 +32,6 @@ const WorkspaceCard = (props: workspaceCardProps) => {
const [description, setDescription] = useState<null | string>(null);
const [showPopUp, setShowPopUp] = useState(false);
const token = localStorage.getItem('token');
const [fileName, setFileName] = useState<string | null>(null);
const [imageSrc, setImageSrc] = useState<string | null>(null);
const [members, setMembers] = useState<members | null>(null);
const [membersArray, setMembersArray]= useState<{username:string}[]>([]);
Expand Down Expand Up @@ -167,7 +167,7 @@ const WorkspaceCard = (props: workspaceCardProps) => {
<div className='workspace-card'>
<div className='workspace-card-body'>
<div
className='workspace-popup-btn'
className='workspace-popup-btn pointer'
onClick={() => setShowPopUp(showPopUp ? false : true)}
>
{!workspaceName.endsWith('-userspace') && (
Expand All @@ -178,24 +178,24 @@ const WorkspaceCard = (props: workspaceCardProps) => {
)}
</div>
<div className={showPopUp ? 'workspace-popup' : 'hide'}>
<div className='pin' onClick={HandlePin}>
<div className='pin pointer' onClick={HandlePin}>
{bookmark ? 'UnPin' : 'Pin'}
</div>
<div className='archive' onClick={HandleArchive}>
<div className='archive pointer' onClick={HandleArchive}>
{archeive ? 'Unarchive' : 'archive'}
</div>
{members &&
userContext?.username &&
members[userContext?.username.toString()] === 'admin' && (
<div className='delete' onClick={HandleDelete}>
<div className='delete pointer' onClick={HandleDelete}>
delete
</div>
)}
{members &&
userContext?.username &&
members[userContext?.username.toString()] === 'admin' && (
<div
className='Edit'
className='Edit pointer'
onClick={() => navigate(`/editWorkspace/${workspaceName}`)}
>
edit
Expand All @@ -219,7 +219,7 @@ const WorkspaceCard = (props: workspaceCardProps) => {
? "USER's WORKSPACE"
: workspaceName}
</div>
<div className='members-view-container' onClick={()=>navigate(`/workspaceMembers/${workspaceName}`)}>
<div className='members-view-container pointer' onClick={()=>navigate(`/workspaceMembers/${workspaceName}`)}>
<div className='workspace-members-imgs'>
<div className='image-stack'>
{ membersArray.length > 0 ? (
Expand Down Expand Up @@ -258,6 +258,7 @@ const WorkspaceCard = (props: workspaceCardProps) => {
<div className='workspace-details-btn'>
<img
src={rightNavbtn}
className='pointer'
onClick={() => navigate(`/workspace/${workspaceName}`)}
alt=''
/>
Expand Down

0 comments on commit 416af5d

Please sign in to comment.