From 4524f98ec05423aa728d73a17118e0d2f94baafa Mon Sep 17 00:00:00 2001
From: Toni <2703233+toniengelhardt@users.noreply.github.com>
Date: Mon, 13 Feb 2023 20:35:10 +0000
Subject: [PATCH] feat: webapi detail pages
---
components/api/Status.vue | 46 +++++++++
components/api/grid/Grid.vue | 5 +-
components/api/grid/GridItem.vue | 10 +-
components/api/list/List.vue | 5 +-
components/api/list/ListItem.vue | 5 +-
components/brand/Name.vue | 10 +-
composables/webapis.ts | 38 +++++++
pages/apis/[id].vue | 160 +++++++++++++++++++++++++++++
pages/index.vue | 34 +++---
types/ui.d.ts | 1 +
types/{index.d.ts => webapis.d.ts} | 11 +-
unocss.config.ts | 4 +-
utils/{apis.ts => webapis.ts} | 132 ++++++++++++------------
13 files changed, 355 insertions(+), 106 deletions(-)
create mode 100644 components/api/Status.vue
create mode 100644 composables/webapis.ts
create mode 100644 pages/apis/[id].vue
create mode 100644 types/ui.d.ts
rename types/{index.d.ts => webapis.d.ts} (78%)
rename utils/{apis.ts => webapis.ts} (91%)
diff --git a/components/api/Status.vue b/components/api/Status.vue
new file mode 100644
index 0000000..c7006f2
--- /dev/null
+++ b/components/api/Status.vue
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+ {{ status?.label }}
+
+
+
+
+
diff --git a/components/api/grid/Grid.vue b/components/api/grid/Grid.vue
index 2f3d53a..198d62c 100644
--- a/components/api/grid/Grid.vue
+++ b/components/api/grid/Grid.vue
@@ -2,8 +2,9 @@
@@ -12,4 +13,6 @@
defineProps<{
apis: WebAPI[]
}>()
+
+const webApiStatuses: Ref<{ [key: keyof typeof webApiData]: boolean }> = useState('webApiStatuses')
diff --git a/components/api/grid/GridItem.vue b/components/api/grid/GridItem.vue
index 3295642..664aad6 100644
--- a/components/api/grid/GridItem.vue
+++ b/components/api/grid/GridItem.vue
@@ -1,8 +1,7 @@
@@ -16,7 +15,7 @@
{{ api.path || 'N/A' }}
-
+
const props = defineProps<{
api: WebAPI
+ available?: boolean
}>()
const status = computed(() => {
- if (props.api.available) {
+ if (props.available) {
if (props.api.experimental) {
return {
name: 'experimental',
@@ -74,7 +74,7 @@ const status = computed(() => {
label: 'Available',
}
}
- if (props.api.available === false) {
+ if (props.available === false) {
return {
name: 'unavailable',
icon: 'cross',
diff --git a/components/api/list/List.vue b/components/api/list/List.vue
index 819f460..e928fbf 100644
--- a/components/api/list/List.vue
+++ b/components/api/list/List.vue
@@ -2,8 +2,9 @@
@@ -12,4 +13,6 @@
defineProps<{
apis: WebAPI[]
}>()
+
+const webApiStatuses: Ref<{ [key: keyof typeof webApiData]: boolean }> = useState('webApiStatuses')
diff --git a/components/api/list/ListItem.vue b/components/api/list/ListItem.vue
index 769b58b..203d548 100644
--- a/components/api/list/ListItem.vue
+++ b/components/api/list/ListItem.vue
@@ -26,10 +26,11 @@
+
+
+
+
+
+
{{ webApi.name }}
+
+
+
+
+
+ {{ status?.label }}
+
+
+
+
+
+ Property
+
+
+ {{ webApi.path }}
+
+
+
+
+
+ Documentation
+
+
+
+ OPEN
+
+
+
+
+
+
+
+
+ Available in Web Workers
+
+
+
+
+ User interaction required
+
+
+
+
+ Permission/s required
+
+
+
+
+ Secure context required
+
+
+
+
+
+
+
+
+
diff --git a/pages/index.vue b/pages/index.vue
index 909a0e3..c6cec42 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -36,8 +36,6 @@