This repository has been archived by the owner on Feb 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from multinet-app/sidebar-component
Sidebar component
- Loading branch information
Showing
11 changed files
with
445 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
<v-navigation-drawer | ||
app | ||
fixed | ||
permanent | ||
stateless | ||
value="true" | ||
> | ||
<v-toolbar | ||
color="grey lighten-2" | ||
> | ||
<v-toolbar-title>multinet</v-toolbar-title> | ||
<v-spacer /> | ||
<v-btn icon> | ||
<v-avatar | ||
color="grey lighten-4" | ||
size="36px" | ||
> | ||
<v-icon color="grey">account_circle</v-icon> | ||
</v-avatar> | ||
</v-btn> | ||
</v-toolbar> | ||
|
||
<WorkspaceDialog | ||
@created="addWorkspace" | ||
/> | ||
|
||
<v-list subheader> | ||
<v-subheader>Your Workspaces</v-subheader> | ||
|
||
<v-divider></v-divider> | ||
|
||
<v-list-tile | ||
active-class="grey lighten-4" | ||
avatar | ||
ripple | ||
:key="space" | ||
:to="`/workspaces/${space}/`" | ||
v-for="space in workspaces" | ||
> | ||
<v-list-tile-avatar> | ||
<v-icon color="primary">library_books</v-icon> | ||
</v-list-tile-avatar> | ||
|
||
<v-list-tile-content> | ||
<v-list-tile-title>{{space}}</v-list-tile-title> | ||
</v-list-tile-content> | ||
</v-list-tile> | ||
</v-list> | ||
</v-navigation-drawer> | ||
</template> | ||
|
||
<script> | ||
import api from '@/api' | ||
import WorkspaceDialog from '@/components/WorkspaceDialog' | ||
export default { | ||
data () { | ||
return { | ||
newWorkspace: '', | ||
workspaces: [], | ||
right: null | ||
} | ||
}, | ||
components: { | ||
WorkspaceDialog | ||
}, | ||
methods: { | ||
route (workspace) { | ||
this.$router.push(`/workspaces/${workspace}`); | ||
}, | ||
addWorkspace (workspace) { | ||
const workspaces = this.workspaces.concat([workspace]); | ||
this.workspaces = workspaces.sort(); | ||
}, | ||
}, | ||
async created () { | ||
const response = await api().post('multinet/graphql', {query: `query { | ||
workspaces { name } | ||
}`}); | ||
this.workspaces = response.data.data.workspaces.map(space => space.name); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<template> | ||
<v-dialog | ||
v-model="dialog" | ||
width="500" | ||
> | ||
<template v-slot:activator="{ on }"> | ||
<v-btn | ||
class="ws-btn ma-0 pa-4" | ||
block | ||
color="grey darken-3" | ||
dark | ||
depressed | ||
large | ||
v-on="on" | ||
> | ||
New Workspace | ||
<v-spacer /> | ||
<v-icon right dark>add_circle</v-icon> | ||
</v-btn> | ||
</template> | ||
|
||
<v-card> | ||
<v-card-title | ||
class="headline pb-0 pt-3" | ||
primary-title | ||
> | ||
Create Workspace | ||
</v-card-title> | ||
|
||
<v-card-text class="px-4 pt-4 pb-1"> | ||
<v-text-field | ||
box | ||
label="Workspace name" | ||
v-model="newWorkspace" | ||
/> | ||
</v-card-text> | ||
|
||
<v-divider></v-divider> | ||
|
||
<v-card-actions class="px-4 py-3"> | ||
<v-spacer></v-spacer> | ||
<v-btn | ||
color="grey darken-3" | ||
dark | ||
depressed | ||
@click="create" | ||
> | ||
Create Workspace | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script> | ||
import api from '@/api' | ||
export default { | ||
data () { | ||
return { | ||
dialog: false | ||
} | ||
}, | ||
methods: { | ||
async create () { | ||
if (this.newWorkspace) { | ||
const response = await api().post('multinet/graphql', {query: `mutation { | ||
workspace (name: "${this.newWorkspace}" ) | ||
}`}); | ||
if (response.data.data) { | ||
this.$router.push(`/workspaces/${this.newWorkspace}`); | ||
this.$emit('created', this.newWorkspace); | ||
this.dialog = false; | ||
} | ||
} | ||
}, | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.ws-btn.v-btn { | ||
border-radius: 0; | ||
height: auto; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<v-container | ||
fill-height | ||
fluid | ||
> | ||
<sidebar /> | ||
|
||
<v-content> | ||
<div class="getting-started"> | ||
<v-icon | ||
class="gs-icon" | ||
color="blue-grey lighten-3" | ||
> | ||
outlined_flag | ||
</v-icon> | ||
<div class="gs-content"> | ||
<h1 class="gs-title">Getting Started...</h1> | ||
<p class="gs-text">Use the sidebar to the left to create a workspace or select an existing one.</p> | ||
</div> | ||
</div> | ||
</v-content> | ||
</v-container> | ||
</template> | ||
|
||
<script> | ||
import Sidebar from '@/components/Sidebar' | ||
export default { | ||
components: { | ||
Sidebar | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.getting-started { | ||
align-items: flex-start; | ||
display: flex; | ||
justify-content: center; | ||
margin: 0 auto 100px; | ||
max-width: 600px; | ||
} | ||
.v-icon.gs-icon { | ||
font-size: 86px; | ||
margin-right: 15px; | ||
} | ||
.gs-title { | ||
color: #b0bec5; | ||
font-size: 36px; | ||
} | ||
.gs-text { | ||
font-size: 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.