Skip to content

Commit

Permalink
Merge pull request #595 from rstudio/dotnomad/destination-empty-state
Browse files Browse the repository at this point in the history
Create Destination empty state button to add destination
  • Loading branch information
dotNomad authored Dec 14, 2023
2 parents 5f5a895 + 6c5e7ad commit 7046ae0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/src/components/PCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defineProps({
}

.card-header {
&:not(:last-child) {
&:not(:empty) {
margin-bottom: 12px;
}
}
Expand Down
7 changes: 7 additions & 0 deletions web/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ h1, h2, h3, h4, h5, h6, p {
text-overflow: ellipsis;
white-space: nowrap;
}

.body--light .text-low-contrast {
color: #757575;
}
.body--dark .text-low-contrast {
color: #9e9e9e;
}
34 changes: 32 additions & 2 deletions web/src/views/project-page/ProjectPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,45 @@
</h2>

<PButton
v-if="hasDeployments"
hierarchy="primary"
:to="{ name: 'addNewDeployment' }"
>
Add Destination
</PButton>
</div>

<div class="card-grid">
<div
v-if="hasDeployments"
class="card-grid"
>
<DeploymentCard
v-for="deployment in deployments"
:key="deployment.id"
:deployment="deployment"
/>
</div>
<div v-else>
<PCard
:to="{ name: 'addNewDeployment' }"
>
<div class="flex column items-center">
<q-icon
name="add"
size="2rem"
/>
<h3 class="text-body1 text-weight-medium q-mt-sm">
Add a New Destination
</h3>
<p class="q-mt-xs text-low-contrast">
This project hasn't been published yet.
</p>
<p class="text-low-contrast">
Get started by adding a destination.
</p>
</div>
</PCard>
</div>

<h2 class="text-h6">
Configurations
Expand All @@ -46,7 +71,7 @@
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { computed, ref } from 'vue';

import { useApi } from 'src/api';
import { Deployment, isDeploymentError } from 'src/api/types/deployments';
Expand All @@ -55,11 +80,16 @@ import ConfigCard from './ConfigCard.vue';
import DeploymentCard from './DeploymentCard.vue';
import FileTree from 'src/components/FileTree.vue';
import PButton from 'src/components/PButton.vue';
import PCard from 'src/components/PCard.vue';

const api = useApi();
const deployments = ref<Deployment[]>([]);
const configurations = ref<Array<Configuration | ConfigurationError>>([]);

const hasDeployments = computed(() => {
return deployments.value.length > 0;
});

async function getDeployments() {
const response = (await api.deployments.getAll()).data;
deployments.value = response.filter<Deployment>((d): d is Deployment => {
Expand Down

0 comments on commit 7046ae0

Please sign in to comment.