Skip to content

Commit

Permalink
UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mechelon committed Sep 20, 2024
1 parent 76250d3 commit 3d771ed
Show file tree
Hide file tree
Showing 39 changed files with 953 additions and 41 deletions.
2 changes: 1 addition & 1 deletion resources/js/internal-dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
<title>Expose Dashboard</title>
</head>
<body>
<div id="app"></div>
Expand Down
109 changes: 100 additions & 9 deletions resources/js/internal-dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions resources/js/internal-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@vueuse/core": "^11.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-vue-next": "^0.441.0",
Expand All @@ -18,6 +19,8 @@
"vue": "^3.4.37"
},
"devDependencies": {
"@iconify-json/radix-icons": "^1.2.0",
"@iconify/vue": "^4.1.2",
"@types/node": "^22.5.5",
"@vitejs/plugin-vue": "^5.1.2",
"autoprefixer": "^10.4.20",
Expand Down
82 changes: 74 additions & 8 deletions resources/js/internal-dashboard/src/InternalDashboard.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,84 @@
<script setup lang="ts">
import { Button } from '@/components/ui/button'
import { ref } from 'vue';
import Header from '@/components/Header.vue'
import ResponseBadge from '@/components/ui/ResponseBadge.vue'
import { exampleRequests, exampleSubdomains } from './lib/devUtils';
import { Card } from './components/ui/card';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/components/ui/table'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger
} from '@/components/ui/tooltip'
const counter = ref(0 as number)
const requests = exampleRequests() as ExposeRequest[]
const subdomains = exampleSubdomains() as string[]
</script>

<template>
<div>
<Button @click="counter++">Hello there</Button>
<div class="">

<div>
{{ counter }}
<Header :subdomains="subdomains" />


<div class="flex items-start max-w-7xl mx-auto mt-8 space-x-8">
<div class="">
<Card>
<!-- <Button>
Clear
</Button> -->
<Table>
<TableHeader>
<TableRow>
<TableHead></TableHead>
<TableHead class="">
URL
</TableHead>
<TableHead class="text-right">
Duration
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="request in requests" :key="request.id">
<TableCell>
<ResponseBadge :statusCode="request.response.status" />
</TableCell>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<TableCell class="font-medium max-w-[200px] truncate text-left">
<span class="opacity-60">{{ request.request.method }}</span> <br />{{ request.request.uri }}
</TableCell>
</TooltipTrigger>
<TooltipContent>
{{ request.request.uri }}
</TooltipContent>
</Tooltip>
</TooltipProvider>


<TableCell>
{{ request.duration }}ms
</TableCell>
</TableRow>
</TableBody>
</Table>
</Card>
</div>

<Card class="">
{{ requests }}
</Card>
</div>
</div>

</div>
</template>
115 changes: 115 additions & 0 deletions resources/js/internal-dashboard/src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<script setup lang="ts">
import { useColorMode } from '@vueuse/core'
import Search from '@/components/ui/Search.vue'
import { Icon } from '@iconify/vue'
import { Button } from '@/components/ui/button'
import { ref } from 'vue';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger
} from '@/components/ui/tooltip'
defineProps<{
subdomains: string[]
}>()
const mode = useColorMode()
const followRequests = ref(true as boolean)
const toggleAppearance = () => {
if (mode.value === 'light') {
mode.value = 'dark'
} else {
mode.value = 'light'
}
}
const toggleFollowRequests = () => {
followRequests.value = !followRequests.value
}
</script>


<template>
<div>
<div class="max-w-7xl mx-auto px-4 py-6 flex items-center justify-between">
<div>
<a href="https://expose.dev" target="_blank" class="inline-flex items-center self-start">
<img src="https://beyondco.de/apps/icons/expose.png" class="h-10">
<p class="ml-4 text-2xl tracking-tight font-bold">Dashboard</p>
</a>

<div class="text-sm mt-1">
<a href="{{ subdomains[0] }}" class="font-medium">
{{ subdomains[0].substring(subdomains[0].lastIndexOf("/") + 1) }}
</a>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<span v-if="subdomains.length > 1" class="opacity-50 ">
&nbsp;and {{ subdomains.length - 1 }} more
</span>
</TooltipTrigger>
<TooltipContent>
<div class="font-medium">Waiting for requests on</div>
<ul class="list-disc ml-4 space-y-1 mb-0.5 mt-1">
<li v-for="subdomain in subdomains" :key="subdomain" :href="subdomain">
<a href="{{ subdomain }}" class="">
{{ subdomain.substring(subdomain.lastIndexOf("/") + 1) }}
</a>
</li>
</ul>
</TooltipContent>
</Tooltip>
</TooltipProvider>


</div>
</div>

<div class="flex items-center space-x-4">
<Search />
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Button @click="toggleFollowRequests" variant="outline"
:class="{ 'border-pink-600 text-pink-600': followRequests }">
<Icon icon="radix-icons:enter" class="h-[1.2rem] w-[1.2rem] " />
<span class="sr-only">Toggle follow requests</span>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Follow Requests: {{ followRequests }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>

<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Button @click="toggleAppearance" variant="outline">
<Icon icon="radix-icons:moon"
class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Icon icon="radix-icons:sun"
class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<span class="sr-only">Toggle Appearance</span>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Toggle Appearance</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>

</div>

</div>
<div class="border-b"></div>
</div>
</template>
Loading

0 comments on commit 3d771ed

Please sign in to comment.