瀏覽代碼

crude settings page

Sean Rhee 5 年之前
父節點
當前提交
73145d302b

+ 16 - 0
dashboard/src/assets/settings.svg

@@ -0,0 +1,16 @@
+<svg width="28" height="30" viewBox="0 0 28 30" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g filter="url(#filter0_d)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M22.4023 13.5801C22.7599 13.7701 23.0359 14.0701 23.23 14.3701C23.6082 14.9901 23.5775 15.7501 23.2096 16.4201L22.4942 17.6201C22.1161 18.2601 21.411 18.6601 20.6854 18.6601C20.3277 18.6601 19.9291 18.5601 19.6021 18.3601C19.3364 18.1901 19.0298 18.1301 18.7028 18.1301C17.691 18.1301 16.8428 18.9601 16.8121 19.9501C16.8121 21.1001 15.8719 22.0001 14.6967 22.0001H13.3068C12.1214 22.0001 11.1812 21.1001 11.1812 19.9501C11.1607 18.9601 10.3125 18.1301 9.30076 18.1301C8.96351 18.1301 8.65693 18.1901 8.40144 18.3601C8.07441 18.5601 7.66563 18.6601 7.31816 18.6601C6.58235 18.6601 5.8772 18.2601 5.49908 17.6201L4.79393 16.4201C4.4158 15.7701 4.39536 14.9901 4.77349 14.3701C4.937 14.0701 5.24359 13.7701 5.59106 13.5801C5.8772 13.4401 6.06116 13.2101 6.23489 12.9401C6.74587 12.0801 6.43928 10.9501 5.57062 10.4401C4.55888 9.87012 4.23185 8.60012 4.81437 7.61012L5.49908 6.43012C6.09181 5.44012 7.35904 5.09012 8.381 5.67012C9.2701 6.15012 10.4249 5.83012 10.9461 4.98012C11.1096 4.70012 11.2016 4.40012 11.1812 4.10012C11.1607 3.71012 11.2731 3.34012 11.4673 3.04012C11.8454 2.42012 12.5301 2.02012 13.2762 2.00012H14.7171C15.4734 2.00012 16.1581 2.42012 16.5362 3.04012C16.7202 3.34012 16.8428 3.71012 16.8121 4.10012C16.7917 4.40012 16.8837 4.70012 17.0472 4.98012C17.5684 5.83012 18.7232 6.15012 19.6225 5.67012C20.6343 5.09012 21.9117 5.44012 22.4942 6.43012L23.1789 7.61012C23.7717 8.60012 23.4447 9.87012 22.4227 10.4401C21.554 10.9501 21.2474 12.0801 21.7686 12.9401C21.9322 13.2101 22.1161 13.4401 22.4023 13.5801ZM11.1096 12.0101C11.1096 13.5801 12.4075 14.8301 14.012 14.8301C15.6165 14.8301 16.8837 13.5801 16.8837 12.0101C16.8837 10.4401 15.6165 9.18012 14.012 9.18012C12.4075 9.18012 11.1096 10.4401 11.1096 12.0101Z" fill="white"/>
+</g>
+<defs>
+<filter id="filter0_d" x="-2" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
+<feFlood flood-opacity="0" result="BackgroundImageFix"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
+<feOffset dy="4"/>
+<feGaussianBlur stdDeviation="2"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
+</filter>
+</defs>
+</svg>

+ 5 - 0
dashboard/src/main/home/Home.tsx

@@ -20,6 +20,7 @@ import IntegrationsInstructionsModal from './modals/IntegrationsInstructionsModa
 import NewProject from './new-project/NewProject';
 import Navbar from './navbar/Navbar';
 import Provisioner from './new-project/Provisioner';
+import ProjectSettings from './project-settings/ProjectSettings';
 
 type PropsType = {
   logOut: () => void
@@ -163,6 +164,10 @@ export default class Home extends Component<PropsType, StateType> {
           viewData={this.state.viewData}
         />
       );
+    } else if (currentView === 'project-settings') {
+      return (
+        <ProjectSettings  setCurrentView={(x: string) => this.setState({ currentView: x })} />
+      )
     }
 
     return (

+ 1 - 1
dashboard/src/main/home/dashboard/Dashboard.tsx

@@ -39,7 +39,7 @@ export default class Dashboard extends Component<PropsType, StateType> {
               })}
             >
               more_vert
-          </i>
+            </i>
           </TitleSection>
 
           <InfoSection>

+ 17 - 7
dashboard/src/main/home/modals/UpdateProjectModal.tsx

@@ -16,6 +16,8 @@ type PropsType = {
 
 type StateType = {
   projectName: string,
+  textValue: string,
+  valid: boolean,
   status: string | null,
   showDeleteOverlay: boolean
 };
@@ -23,6 +25,8 @@ type StateType = {
 export default class UpdateProjectModal extends Component<PropsType, StateType> {
   state = {
     projectName: this.context.currentModalData.currentProject.name,
+    textValue: '',
+    valid: false,
     status: null as string | null,
     showDeleteOverlay: false,
   };
@@ -95,9 +99,9 @@ export default class UpdateProjectModal extends Component<PropsType, StateType>
           <CloseButtonImg src={close} />
         </CloseButton>
 
-        <ModalTitle>Project Settings</ModalTitle>
+        <ModalTitle>Delete Project</ModalTitle>
         <Subtitle>
-          Project name
+          Type {this.state.projectName} to delete.
         </Subtitle>
 
         <InputWrapper>
@@ -106,11 +110,17 @@ export default class UpdateProjectModal extends Component<PropsType, StateType>
             <Letter>{this.state.projectName ? this.state.projectName[0].toUpperCase() : '-'}</Letter>
           </ProjectIcon>
           <InputRow
-            disabled={true}
+            disabled={false}
             type='string'
-            value={this.state.projectName}
-            setValue={(x: string) => this.setState({ projectName: x })}
-            placeholder='ex: perspective-vortex'
+            value={this.state.textValue}
+            setValue={(x: string) => this.setState({ textValue: x }, () => {
+              if (this.state.textValue === this.state.projectName) {
+                this.setState({ valid: true });
+              } else {
+                this.setState({ valid: false });
+              }
+            })}
+            placeholder={this.state.projectName}
             width='470px'
           />
         </InputWrapper>
@@ -128,7 +138,7 @@ export default class UpdateProjectModal extends Component<PropsType, StateType>
         <SaveButton
           text='Delete Project'
           color='#b91133'
-          onClick={() => this.setState({ showDeleteOverlay: true })}
+          onClick={() => {if (this.state.valid) {this.setState({ showDeleteOverlay: true })}}}
           status={this.state.status}
         />
 

+ 256 - 0
dashboard/src/main/home/project-settings/ProjectSettings.tsx

@@ -0,0 +1,256 @@
+import React, { Component } from 'react';
+import styled from 'styled-components';
+
+import gradient from '../../../assets/gradient.jpg';
+
+import { Context } from '../../../shared/Context';
+
+type PropsType = {
+  setCurrentView: (x: string) => void,
+}
+
+type StateType = {
+  inviteLink: string,
+}
+
+export default class ProjectSettings extends Component<PropsType, StateType> {
+  state = {
+    inviteLink: 'https://asdjfijawioejfialawe.awef.awejiofawjefkajweilfjioawjfli/ajfwieofjaiowejfklajwle/fjawieofaw',
+  }
+
+  renderTitle = () => {
+    let { currentProject } = this.context;
+    if (currentProject) {
+      return (
+        <>
+          <TitleSection>
+            <DashboardIcon>
+              <DashboardImage src={gradient} />
+              <Overlay>{currentProject.name[0].toUpperCase()}</Overlay>
+            </DashboardIcon>
+            <Title>{currentProject.name} Settings</Title>
+          </TitleSection>
+          <LineBreak />
+        </>
+      );
+    }
+  }
+
+  copyToClip = () => {
+    navigator.clipboard.writeText(this.state.inviteLink).then(function() {
+    }, function() {
+      console.log("couldn't copy link to clipboard");
+    })
+  }
+
+  renderCollab = () => {
+    return (
+      <>
+        <Subtitle>Manage Access</Subtitle>
+        <Rower>
+          <ShareLink
+            disabled={true}
+            type='string'
+            value={this.state.inviteLink}
+            placeholder='no link available'
+          />
+          <CopyButton
+            onClick={() => this.copyToClip()}
+          >
+            Copy Link:
+          </CopyButton>
+        </Rower>
+      </>
+    )
+  }
+
+  renderDelete = () => {
+    let { currentProject } = this.context;
+    if (currentProject) {
+      return (
+        <>
+          <Subtitle>Other Settings</Subtitle>
+          <Rower>
+            <BodyText>
+              Delete this project: 
+            </BodyText>
+            <DeleteButton
+              onClick={() => this.context.setCurrentModal('UpdateProjectModal', { 
+                currentProject: currentProject,
+                setCurrentView: this.props.setCurrentView,
+              })}
+            >
+              Delete
+            </DeleteButton>
+          </Rower>
+        </>
+      )
+    }
+  }
+
+  renderContents = () => {
+    return (
+      <ContentHolder>
+          {this.renderCollab()}
+          {this.renderDelete()}
+      </ContentHolder>
+    )
+  }
+
+  render () {
+    return (
+      <StyledProjectSettings>
+        {this.renderTitle()}
+        {this.renderContents()}
+      </StyledProjectSettings>
+    );
+  }
+}
+
+ProjectSettings.contextType = Context;
+
+const Overlay = styled.div`
+  height: 100%;
+  width: 100%;
+  position: absolute;
+  background: #00000028;
+  top: 0;
+  left: 0;
+  border-radius: 5px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 24px;
+  font-weight: 500;
+  font-family: 'Work Sans', sans-serif;
+  color: white;
+`;
+
+const DashboardImage = styled.img`
+  height: 45px;
+  width: 45px;
+  border-radius: 5px;
+`;
+
+const DashboardIcon = styled.div`
+  position: relative;
+  height: 45px;
+  width: 45px;
+  border-radius: 5px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+
+  > i {
+    font-size: 22px;
+  }
+`;
+
+const Title = styled.div`
+  font-size: 24px;
+  font-weight: 600;
+  font-family: 'Work Sans', sans-serif;
+  color: #ffffff;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  margin-left: 20px;
+`;
+
+const TitleSection = styled.div`
+  margin-bottom: 20px;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  height: 40px;
+`;
+
+const StyledProjectSettings = styled.div`
+  width: calc(90% - 150px);
+  min-width: 300px;
+  padding-top: 45px;
+`;
+
+const LineBreak = styled.div`
+  width: calc(100% - 0px);
+  height: 2px;
+  background: #ffffff20;
+  margin: 10px 0px -20px;
+`;
+
+const Subtitle = styled.div`
+  font-size: 18px;
+  font-weight: 700;
+  font-family: 'Work Sans', sans-serif;
+  color: #ffffff;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  margin-bottom: 24px;
+  margin-top: 32px;
+`;
+
+const BodyText = styled.div`
+  color: #ffffff;
+  font-weight: 400;
+  font-size: 13px;
+`;
+
+const CopyButton = styled.div`
+  color: #ffffff;
+  font-weight: 400;
+  font-size: 13px;
+  margin-left: 12px;
+  float: right;
+  width: 128px;
+  padding-top: 8px;
+  padding-bottom: 8px;
+  border-radius: 5px;
+  border: 1px solid #ffffff20;
+  background-color: #ffffff10;
+  text-align: center;
+  overflow: hidden;
+  transition: all 0.1s ease-out;
+  :hover {
+    border: 1px solid #ffffff66;
+    background-color: #ffffff20;
+  }
+`;
+
+const DeleteButton = styled(CopyButton)`
+  background-color: #b91133;
+  border: none;
+  width: 88px;
+  margin-left: 20px;
+  :hover {
+    background-color: #b91133;
+    filter: brightness(120%);
+    border: none;
+  }
+`;
+
+const ContentHolder = styled.div`
+  min-width: 420px;
+  width: 100%;
+`;
+
+const Rower = styled.div`
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+`;
+
+const ShareLink = styled.input`
+  outline: none;
+  border: none;
+  font-size: 13px;
+  background: #ffffff11;
+  border: 1px solid #ffffff55;
+  border-radius: 3px;
+  width: 100%;
+  color: #74a5f7;
+  padding: 5px 10px;
+  margin-right: 8px;
+  height: 30px;
+  text-overflow: ellipsis;
+`;

+ 8 - 0
dashboard/src/main/home/sidebar/Sidebar.tsx

@@ -3,6 +3,7 @@ import styled from 'styled-components';
 import category from '../../../assets/category.svg';
 import integrations from '../../../assets/integrations.svg';
 import filter from '../../../assets/filter.svg';
+import settings from '../../../assets/settings.svg';
 
 import { Context } from '../../../shared/Context';
 
@@ -124,6 +125,13 @@ export default class Sidebar extends Component<PropsType, StateType> {
             <img src={integrations} />
             Integrations
           </NavButton>
+          <NavButton
+            onClick={() => this.props.setCurrentView('project-settings')}
+            selected={this.props.currentView === 'project-settings'}
+          >
+            <img src={settings} />
+            Settings
+          </NavButton>
 
           <br />