refactor: cleanup documentation page

This commit is contained in:
liyasthomas
2021-07-30 21:06:25 +05:30
parent 203b45f4d5
commit a1eac2f348
4 changed files with 171 additions and 117 deletions

View File

@@ -50,7 +50,7 @@
<span class="truncate"> {{ request.name }} </span> <span class="truncate"> {{ request.name }} </span>
</span> </span>
<ButtonSecondary <ButtonSecondary
v-if="!saveRequest" v-if="!saveRequest && !doc"
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
icon="replay" icon="replay"
:title="$t('restore')" :title="$t('restore')"

View File

@@ -43,7 +43,7 @@
<span class="truncate"> {{ request.name }} </span> <span class="truncate"> {{ request.name }} </span>
</span> </span>
<ButtonSecondary <ButtonSecondary
v-if="!saveRequest" v-if="!saveRequest && !doc"
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
icon="replay" icon="replay"
:title="$t('restore')" :title="$t('restore')"

View File

@@ -203,8 +203,8 @@
"variable_count": "Variable {count}", "variable_count": "Variable {count}",
"value_count": "Value {count}", "value_count": "Value {count}",
"send_request_first": "Send a request first", "send_request_first": "Send a request first",
"generate_docs": "Generate Documentation", "generate_docs": "Generate documentation",
"generate_docs_message": "Import any Hoppscotch Collection to Generate Documentation on-the-go.", "generate_docs_message": "Import any Hoppscotch collection to generate API documentation on-the-go.",
"generate_docs_first": "Generate documentation first", "generate_docs_first": "Generate documentation first",
"docs_generated": "Documentation generated", "docs_generated": "Documentation generated",
"import_collections": "Import collections", "import_collections": "Import collections",

View File

@@ -1,17 +1,40 @@
<template> <template>
<div>
<Splitpanes :dbl-click-splitter="false" vertical> <Splitpanes :dbl-click-splitter="false" vertical>
<Pane class="hide-scrollbar !overflow-auto"> <Pane class="hide-scrollbar !overflow-auto">
<Splitpanes :dbl-click-splitter="false" horizontal> <Splitpanes :dbl-click-splitter="false" horizontal>
<Pane class="hide-scrollbar !overflow-auto"> <Pane class="hide-scrollbar !overflow-auto">
<AppSection label="import"> <AppSection label="import">
<div class="flex flex-col"> <div class="flex p-4 items-start justify-between">
<label>{{ $t("collection") }}</label> <label class="font-semibold">
<p>
{{ $t("generate_docs_message") }} {{ $t("generate_docs_message") }}
</p> </label>
<div class="flex flex-1"> <span
<label for="collectionUpload"> class="
bg-accentLight
rounded
font-semibold
text-primary
py-1
px-2
inline-flex
"
>
BETA
</span>
</div>
<div
class="
bg-primary
border-b border-dividerLight
flex
top-0
z-10
items-start
justify-between
sticky
"
>
<label for="collectionUpload" class="font-semibold">
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
title="JSON" title="JSON"
@@ -27,7 +50,6 @@
type="file" type="file"
@change="uploadCollection" @change="uploadCollection"
/> />
<div>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('clear')" :title="$t('clear')"
@@ -35,22 +57,32 @@
@click.native="collectionJSON = '[]'" @click.native="collectionJSON = '[]'"
/> />
</div> </div>
</div>
<SmartAceEditor <SmartAceEditor
v-model="collectionJSON" v-model="collectionJSON"
:lang="'json'" :lang="'json'"
:lint="false" :lint="false"
:options="{ :options="{
maxLines: 16, maxLines: Infinity,
minLines: 8, minLines: 16,
fontSize: '12px', fontSize: '12px',
autoScrollEditorIntoView: true, autoScrollEditorIntoView: true,
showPrintMargin: false, showPrintMargin: false,
useWorker: false, useWorker: false,
}" }"
/> />
<ButtonSecondary <div
icon="topic" class="
bg-primary
flex
p-4
bottom-0
z-10
justify-between
items-start
sticky
"
>
<ButtonPrimary
:label="$t('generate_docs')" :label="$t('generate_docs')"
@click.native="getDoc" @click.native="getDoc"
/> />
@@ -60,22 +92,48 @@
<Pane class="hide-scrollbar !overflow-auto"> <Pane class="hide-scrollbar !overflow-auto">
<AppSection label="documentation"> <AppSection label="documentation">
<div class="flex flex-col"> <div class="flex flex-col">
<label>{{ $t("documentation") }}</label> <div
<p v-if="items.length === 0"> v-if="items.length === 0"
class="
flex flex-col
text-secondaryLight
p-4
items-center
justify-center
"
>
<i class="opacity-75 pb-2 material-icons">topic</i>
<span class="text-center">
{{ $t("generate_docs_first") }} {{ $t("generate_docs_first") }}
</p> </span>
<div v-else class="flex flex-1"> </div>
<div
v-else
class="
bg-primary
border-b border-dividerLight
flex flex-1
p-4
top-0
z-10
sticky
"
>
<div <div
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title=" :title="
!currentUser !currentUser
? $t('login_with_github_to') + $t('create_secret_gist') ? `${$t('login_with_github_to')} ${$t(
'create_secret_gist'
).toLowerCase()}`
: currentUser.provider !== 'github.com' : currentUser.provider !== 'github.com'
? $t('login_with_github_to') + $t('create_secret_gist') ? `${$t('login_with_github_to')} ${$t(
: null 'create_secret_gist'
).toLowerCase()}`
: 'Beta'
" "
> >
<ButtonSecondary <ButtonPrimary
:disabled=" :disabled="
!currentUser !currentUser
? true ? true
@@ -83,19 +141,16 @@
? true ? true
: false : false
" "
icon="assignment" :label="$t('create_secret_gist')"
label="$t('create_secret_gist')"
@click.native="createDocsGist" @click.native="createDocsGist"
/> />
</div> </div>
</div> </div>
<div> <div
<span
v-for="(collection, index) in items" v-for="(collection, index) in items"
:key="`collection-${index}`" :key="`collection-${index}`"
> >
<DocsCollection :collection="collection" /> <DocsCollection :collection="collection" />
</span>
</div> </div>
</div> </div>
</AppSection> </AppSection>
@@ -119,7 +174,6 @@
</aside> </aside>
</Pane> </Pane>
</Splitpanes> </Splitpanes>
</div>
</template> </template>
<script> <script>