Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MI-1987]: Integrated project list UI #28

Merged
merged 7 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion webapp/src/components/buttons/iconButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const IconButton = ({tooltipText, iconClassName, extraClass = '', iconColor, onC
<Tooltip tooltipContent={tooltipText}>
<Button
variant='outline-danger'
className={`button-wrapper ${extraClass} ${iconColor === 'danger' && 'danger'}`}
className={`plugin-btn button-wrapper btn-icon ${extraClass}`}
onClick={onClick}
>
<i
className={iconClassName}
Expand Down
16 changes: 8 additions & 8 deletions webapp/src/components/card/project/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ import IconButton from 'components/buttons/iconButton';

import {onPressingEnterKey} from 'utils';

import './styles.scss';

type ProjectCardProps = {
onProjectTitleClick: (projectDetails: ProjectDetails) => void;
onProjectTitleClick: (projectDetails: ProjectDetails) => void
handleUnlinkProject: () => void
projectDetails: ProjectDetails
}

const ProjectCard = ({onProjectTitleClick, projectDetails: {organization, title}, projectDetails}: ProjectCardProps) => {
const ProjectCard = ({onProjectTitleClick, projectDetails: {organizationName, projectName}, projectDetails, handleUnlinkProject}: ProjectCardProps) => {
return (
<BaseCard>
<div className='d-flex'>
<div className='project-details'>
<p className='margin-bottom-10'>
<span
aria-label={title}
aria-label={projectName}
role='button'
tabIndex={0}
className='font-size-14 font-bold link-title'
onKeyDown={() => onPressingEnterKey(event, () => onProjectTitleClick(projectDetails))}
onClick={() => onProjectTitleClick(projectDetails)}
>
{title}
{projectName}
</span>
</p>
<p className='font-size-14'>{organization}</p>
<p className='font-size-14'>{organizationName}</p>
</div>
<div className='button-wrapper'>
<IconButton
tooltipText='Unlink project'
iconClassName='fa fa-chain-broken'
extraClass='project-details-unlink-button unlink-button'
extraClass='unlink-button'
onClick={handleUnlinkProject}
/>
</div>
</div>
Expand Down
16 changes: 0 additions & 16 deletions webapp/src/components/card/project/styles.scss

This file was deleted.

8 changes: 0 additions & 8 deletions webapp/src/components/card/subscription/styles.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
.project-details {
flex-basis: 70%;
}

.button-wrapper {
flex-basis: 30%;
}

.delete-button {
display: block;
margin-left: auto;
Expand Down
53 changes: 53 additions & 0 deletions webapp/src/components/emptyState/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';

import './styles.scss';

type EmptyStatePropTypes = {
title: string,
subTitle?: {
text: string
slashCommand?: string
},
buttonText?: string,
buttonAction?: (event: React.SyntheticEvent) => void;
}

const EmptyState = ({title, subTitle, buttonText, buttonAction}: EmptyStatePropTypes) => {
return (
avas27JTG marked this conversation as resolved.
Show resolved Hide resolved
<div className='no-data d-flex'>
<div className='d-flex flex-column align-items-center'>
<div className='no-data__icon d-flex justify-content-center align-items-center'>
<svg
width='32px'
height='32px'
viewBox='0 0 32 32'
>
<path d='M0 11.865l2.995-3.953 11.208-4.557v-3.292l9.828 7.188-20.078 3.896v10.969l-3.953-1.141zM32 5.932v19.536l-7.672 6.531-12.401-4.073v4.073l-7.974-9.885 20.078 2.396v-17.26z'/>
</svg>
</div>
<p className='no-data__title'>{title}</p>
{subTitle && (
<>
<p className='no-data__subtitle'>{subTitle.text}</p>
{
subTitle.slashCommand && <p className='slash-command'>{subTitle.slashCommand}</p>
}

</>
)}
{
buttonText && buttonAction && (
<button
onClick={buttonAction}
className='plugin-btn no-data__btn btn btn-primary'
>
{buttonText}
</button>
)
}
</div>
</div>
);
};

export default EmptyState;
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.no-data {
text-align: center;
height: 100%;
min-height: 350px;
justify-content: center;
margin-top: 80px;
text-align: center;

&__icon {
width: 120px;
height: 120px;
width: 100px;
height: 100px;
background: rgba(var(--center-channel-color-rgb), 0.04);
border-radius: 100%;
margin-bottom: 24px;
Expand All @@ -24,4 +25,14 @@
&__btn {
margin-top: 24px;
}

svg {
fill: rgba(var(--center-channel-color-rgb), 0.5);
}
}

.slash-command {
padding: 10px 15px;
border-radius: 4px;
border: 1px solid rgba(var(--center-channel-color-rgb), 0.08);
}
2 changes: 1 addition & 1 deletion webapp/src/components/labelValuePair/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type LabelValuePairProps = {
const LabelValuePair = ({label, value}: LabelValuePairProps) => {
return (
<p className='margin-bottom-10'>
<strong>{label}{': '}</strong>
<strong>{`${label}: `}</strong>
<span className='value'>{value}</span>
</p>
);
Expand Down
29 changes: 29 additions & 0 deletions webapp/src/components/modal/confirmationModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';

import Modal from 'components/modal';

type ConfirmationModalProps = {
isOpen: boolean
title: string
description: string
confirmBtnText: string
onHide: () => void
onConfirm?: () => void
}

const ConfirmationModal = ({isOpen, title, confirmBtnText, description, onHide, onConfirm}: ConfirmationModalProps) => {
return (
avas27JTG marked this conversation as resolved.
Show resolved Hide resolved
<Modal
show={isOpen}
title={title}
onHide={onHide}
onConfirm={onConfirm}
confirmAction={true}
confirmBtnText={confirmBtnText}
>
<p>{description}</p>
</Modal>
);
};

export default ConfirmationModal;
6 changes: 3 additions & 3 deletions webapp/src/components/modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ type ModalProps = {
onConfirm?: () => void;
confirmBtnText?: string;
cancelBtnText?: string;
confirmAction?: boolean;
className?: string;
loading?: boolean;
error?: string | JSX.Element;
confirmDisabled?: boolean;
cancelDisabled?: boolean;
}

const Modal = ({show, onHide, showCloseIconInHeader = true, children, title, subTitle, onConfirm, confirmBtnText, cancelBtnText, className = '', loading = false, error, confirmDisabled = false, cancelDisabled = false}: ModalProps) => {
const Modal = ({show, onHide, showCloseIconInHeader = true, children, title, subTitle, onConfirm, confirmAction, confirmBtnText, cancelBtnText, className = '', loading = false, error}: ModalProps) => {
return (
<RBModal
show={show}
Expand Down Expand Up @@ -54,8 +55,7 @@ const Modal = ({show, onHide, showCloseIconInHeader = true, children, title, sub
onConfirm={onConfirm}
cancelBtnText={cancelBtnText}
confirmBtnText={confirmBtnText}
confirmDisabled={confirmDisabled}
sooraj-shukla marked this conversation as resolved.
Show resolved Hide resolved
cancelDisabled={cancelDisabled}
confirmAction={confirmAction}
/>
</RBModal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ type ModalFooterProps = {
className?: string;
confirmDisabled?: boolean;
cancelDisabled?: boolean;
confirmAction?: boolean;
}

const ModalFooter = ({onConfirm, onHide, cancelBtnText, confirmBtnText, className = '', confirmDisabled, cancelDisabled}: ModalFooterProps) : JSX.Element => (
<RBModal.Footer className={`modal__footer d-flex flex-column justify-content-center align-items-center ${className}`}>
const ModalFooter = ({onConfirm, onHide, cancelBtnText, confirmBtnText, className = '', confirmDisabled, cancelDisabled, confirmAction}: ModalFooterProps) : JSX.Element => (
<RBModal.Footer className={confirmAction ? 'modal__confirm-action' : `modal__footer d-flex flex-column justify-content-center align-items-center ${className}`}>
{onConfirm && (
<button
className='btn btn-primary modal__confirm-btn'
className={`plugin-btn btn ${confirmAction ? 'btn-danger' : 'btn-primary modal__confirm-btn'}`}
onClick={onConfirm}
disabled={confirmDisabled}
>
Expand All @@ -26,7 +27,7 @@ const ModalFooter = ({onConfirm, onHide, cancelBtnText, confirmBtnText, classNam
)}
{onHide && (
<button
className='btn btn-link modal__cancel-btn'
className={`plugin-btn btn btn-link ${!confirmAction && 'modal__cancel-btn'}`}
onClick={onHide}
disabled={cancelDisabled}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
margin: 0 !important;
padding: 0;
}

&__confirm-action {
display: flex;
flex-direction: row-reverse;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import './styles.scss';

type ModalHeaderProps = {
title?: string | JSX.Element;
onHide: () => void;
onHide?: () => void;
showCloseIconInHeader?: boolean;
}

Expand Down
12 changes: 8 additions & 4 deletions webapp/src/containers/Rhs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import React from 'react';

import usePluginApi from 'hooks/usePluginApi';
import {getprojectDetailsState} from 'selectors';
import {getprojectDetailsState, getRhsState} from 'selectors';

import ProjectList from './projectList';
import ProjectDetails from './projectDetails';

const Rhs = (): JSX.Element => {
const usePlugin = usePluginApi();

if (!getRhsState(usePlugin.state).isSidebarOpen) {
return <></>;
}

return (
<div className='height-100vh bg-sidebar padding-25'>
<div className='height-rhs bg-sidebar padding-25'>
{
getprojectDetailsState(usePlugin.state).id ?
<ProjectDetails title={getprojectDetailsState(usePlugin.state).title}/> :
getprojectDetailsState(usePlugin.state).projectID ?
<ProjectDetails title={getprojectDetailsState(usePlugin.state).projectName}/> :
<ProjectList/>
}
</div>
Expand Down
Loading