Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/dwa #196

Merged
merged 58 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
5dcc4c8
feat:dwa-starter-vue-app-hello-word
Johnnyevans32 Oct 1, 2024
1a60fdb
feat:dwa-starter-vue-app-hello-word
Johnnyevans32 Oct 2, 2024
722e6ba
feat:dwa-starter-vue-app-hello-word
Johnnyevans32 Oct 2, 2024
eb70ad6
added tailwind css
Johnnyevans32 Oct 2, 2024
5db4bad
added tailwind css
Johnnyevans32 Oct 2, 2024
6b58d57
added tbd example json for ci integration
Johnnyevans32 Oct 2, 2024
53399f8
added tbd example json for ci integration
Johnnyevans32 Oct 2, 2024
8dc06e1
replaced npm with pnpm in ci/cd file
Johnnyevans32 Oct 2, 2024
bf9ade2
fix:pnpm build error in ci/cd
Johnnyevans32 Oct 2, 2024
323a6f8
fix:pnpm build error in ci/cd
Johnnyevans32 Oct 2, 2024
c855e5f
fix:pnpm build error in ci/cd
Johnnyevans32 Oct 2, 2024
61e7bf9
break the commands into seperate items
Johnnyevans32 Oct 2, 2024
71f033f
break the commands into seperate items
Johnnyevans32 Oct 2, 2024
d1c191b
Setup routes for Home, About, Settings and 404 handling
Johnnyevans32 Oct 3, 2024
0cbffbd
Setup routes for Home, About, Settings and 404 handling
Johnnyevans32 Oct 3, 2024
bf4b6bd
conflict fix
Johnnyevans32 Oct 3, 2024
817dd9d
remove vite config timestamp file
Johnnyevans32 Oct 3, 2024
45863c1
remove vite config timestamp file
Johnnyevans32 Oct 3, 2024
299701c
initial commit
Johnnyevans32 Oct 3, 2024
2d4bc05
initial commit
Johnnyevans32 Oct 3, 2024
8f52853
fix:layout
Johnnyevans32 Oct 3, 2024
f5acb27
fix:layout
Johnnyevans32 Oct 3, 2024
0e5cdd8
fix:layout
Johnnyevans32 Oct 4, 2024
840901f
fix:layout
Johnnyevans32 Oct 4, 2024
ca39e83
responsive nav menu
Johnnyevans32 Oct 4, 2024
4d506f6
responsive nav menu
Johnnyevans32 Oct 4, 2024
d7f09f3
responsive nav menu
Johnnyevans32 Oct 4, 2024
af78a4d
backdrop blur
Johnnyevans32 Oct 4, 2024
fd9e803
updated dark mode specs
Johnnyevans32 Oct 4, 2024
927738f
vite plugin pwa
Johnnyevans32 Oct 4, 2024
ec39945
conflict fix
Johnnyevans32 Oct 4, 2024
9e83878
remove unused navigation menu component
Johnnyevans32 Oct 4, 2024
a728cd6
conflict fix
Johnnyevans32 Oct 4, 2024
3ad3b3a
pwa assets generation and settings page form
Johnnyevans32 Oct 5, 2024
968615c
pwa assets generation and settings page form
Johnnyevans32 Oct 5, 2024
74cd639
web5 connection setup
Johnnyevans32 Oct 5, 2024
7cce532
web5 connection setup
Johnnyevans32 Oct 5, 2024
405d8ae
test case fix
Johnnyevans32 Oct 5, 2024
c60f4fd
test unit specs update
Johnnyevans32 Oct 6, 2024
c504971
Merge branch 'feat/pwa' of https://github.com/Johnnyevans32/tbd-examp…
Johnnyevans32 Oct 6, 2024
456bbda
test unit specs update
Johnnyevans32 Oct 6, 2024
fee7ea8
ci fix
Johnnyevans32 Oct 6, 2024
0ef7b9f
ci fix
Johnnyevans32 Oct 6, 2024
f390c32
ci fix
Johnnyevans32 Oct 6, 2024
e35b107
conflict fix
Johnnyevans32 Oct 7, 2024
d53936f
delete todo unused store
Johnnyevans32 Oct 7, 2024
d87bfeb
conflict fix
Johnnyevans32 Oct 7, 2024
3c3bf8f
conflict fix
Johnnyevans32 Oct 7, 2024
0c8ce1f
seperate web5 connect options button loading state
Johnnyevans32 Oct 7, 2024
174d9fc
seperate web5 connect options button loading state
Johnnyevans32 Oct 7, 2024
98530bf
revert web5 composable to resemble that of the react vite version
Johnnyevans32 Oct 7, 2024
155c104
Merge branch 'main' of https://github.com/TBD54566975/tbd-examples in…
Johnnyevans32 Oct 7, 2024
fc569ee
revert to importing react linb utilties
Johnnyevans32 Oct 7, 2024
c3ead1c
revert to importing react linb utilties
Johnnyevans32 Oct 7, 2024
7b776d7
update
Johnnyevans32 Oct 7, 2024
5331f5a
update
Johnnyevans32 Oct 7, 2024
d189d2a
update
Johnnyevans32 Oct 7, 2024
695280a
update
Johnnyevans32 Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions javascript/dwa-starter-vue/e2e/vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ test('visits the about page', async ({ page }) => {
)
})

// Test for the settings page
test('visits the settings page', async ({ page }) => {
await page.goto('/settings')
await expect(page.locator('h1')).toHaveText('Settings')
})
// TODO: mock web5 connection for access to settings page
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need help with this test or are you planning to add it back in one of the other projects tasks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I do actually, i was going to get more info on this after finishing up the main pages components

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets do this... hold off on this test for now, and lets merge this pr as soon as you address my points above. then after that I can work on mocking/setting up the connection in playwright while you work on your next task. this way we dont block you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha thanks!

// // Test for the settings page
// test('visits the settings page', async ({ page }) => {
// await page.goto('/settings')
// await expect(page.locator('h1')).toHaveText('Settings')
// })

// Test for the 404 page
test('handles 404 - Page Not Found', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
declare module 'vite-plugin-node-stdlib-browser' {
const nodePolyfills: any
export default nodePolyfills
}

declare module 'virtual:pwa-register' {
export function registerSW(options?: {
immediate?: boolean
Expand Down
8 changes: 8 additions & 0 deletions javascript/dwa-starter-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,28 @@
"@radix-icons/vue": "^1.0.0",
"@vee-validate/zod": "^4.13.2",
"@vueuse/core": "^11.1.0",
"@web5/api": "^0.11.0",
"@web5/browser": "^0.0.2",
"autoprefixer": "^10.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^4.1.1",
"postcss": "^8.4.47",
"radix-vue": "^1.9.6",
"tailwind-merge": "^2.5.2",
"tailwindcss": "^3.4.13",
"tailwindcss-animate": "^1.0.7",
"vaul-vue": "^0.2.0",
"vee-validate": "^4.13.2",
"vite-plugin-node-stdlib-browser": "^0.2.1",
"vite-plugin-pwa": "^0.20.5",
"vue": "^3.4.29",
"vue-router": "^4.3.3",
"workbox-precaching": "^7.1.0",
"workbox-routing": "^7.1.0",
"workbox-window": "^7.1.0",
"zipson": "^0.2.12",
"zod": "^3.23.8"
},
"devDependencies": {
Expand Down
2,304 changes: 2,129 additions & 175 deletions javascript/dwa-starter-vue/pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions javascript/dwa-starter-vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import Toaster from '@/components/ui/toast/Toaster.vue'
import NavMenu from '@/components/NavMenu.vue'
import Sidebar from '@/components/Sidebar.vue'
</script>

<template>
<div class="flex min-h-screen lg:flex-row flex-col dark:bg-zinc-950 dark:text-white">
<header class="sticky top-0">
<NavMenu />
<Sidebar />
</header>

<main class="p-4 lg:h-screen overflow-y-auto flex flex-col w-full">
Expand Down
77 changes: 0 additions & 77 deletions javascript/dwa-starter-vue/src/components/NavList.vue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'
import { TextAlignLeftIcon } from '@radix-icons/vue'
import { ref } from 'vue'

import NavList from '@/components/NavList.vue'
import SidebarList from '@/components/SidebarList.vue'

const isOpen = ref(false)
const toggleDrawer = () => {
Expand All @@ -30,11 +30,11 @@ const closeDrawer = () => {
isOpen ? 'translate-x-0' : '-translate-x-full'
]"
>
<NavList @itemClicked="closeDrawer" />
<SidebarList @itemClicked="closeDrawer" />
</div>
</div>

<div class="hidden lg:block h-full p-4 w-64">
<NavList />
<SidebarList />
</div>
</template>
82 changes: 82 additions & 0 deletions javascript/dwa-starter-vue/src/components/SidebarList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<script setup lang="ts">
import { Button } from '@/components/ui/button'
import { useRoute } from 'vue-router'
import { HomeIcon, GearIcon, AvatarIcon } from '@radix-icons/vue'

import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
import { Icon } from '@iconify/vue'

import { useColorMode } from '@vueuse/core'
import { storeToRefs } from 'pinia'
import { useWeb5Store } from '@/stores/web5'
import { computed } from 'vue'
import Web5ConnectButton from '@/components/Web5ConnectButton.vue'

const route = useRoute()

const { web5 } = storeToRefs(useWeb5Store())
const navList = computed(() => [
{ title: 'Home', href: '/', icon: HomeIcon },
{ title: 'About', href: '/about', icon: AvatarIcon },
...(web5.value ? [{ title: 'Settings', href: '/settings', icon: GearIcon }] : [])
])

const emit = defineEmits(['itemClicked'])

const mode = useColorMode()
const handleModeOptionClick = (value: 'light' | 'dark' | 'auto') => {
mode.value = value
emit('itemClicked')
}
</script>

<template>
<nav class="flex flex-col justify-between h-full">
<div class="flex flex-col gap-2">
<div class="flex items-center justify-between">
<h2 class="text-lg">My DWA</h2>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button variant="ghost" class="dark:bg-zinc-950 dark:text-white">
<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 theme</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" class="dark:bg-zinc-950 dark:text-white">
<DropdownMenuItem @click="handleModeOptionClick('light')"> Light </DropdownMenuItem>
<DropdownMenuItem @click="handleModeOptionClick('dark')"> Dark </DropdownMenuItem>
<DropdownMenuItem @click="handleModeOptionClick('auto')"> System </DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
<div class="flex flex-col gap-2">
<div v-for="item in navList" :key="item.title">
<Button
:variant="route.path === item.href ? 'secondary' : 'ghost'"
class="w-full justify-start"
asChild
>
<RouterLink :to="item.href" @click="emit('itemClicked')">
<component :is="item.icon" class="w-4 h-4 mr-2" />
{{ item.title }}
</RouterLink>
</Button>
</div>
</div>
</div>

<Web5ConnectButton />
</nav>
</template>
6 changes: 6 additions & 0 deletions javascript/dwa-starter-vue/src/components/TodoList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script setup lang="ts"></script>

<template>
<h1>Todo</h1>
<p>coming soon</p>
</template>
79 changes: 79 additions & 0 deletions javascript/dwa-starter-vue/src/components/Web5ConnectButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { Button } from '@/components/ui/button'
import { useWeb5Connection } from '@/composables/web5Connection'
import { Link2Icon, ReloadIcon, LinkBreak2Icon, Cross1Icon } from '@radix-icons/vue'

import {
Drawer,
DrawerContent,
DrawerDescription,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
DrawerFooter,
DrawerClose
} from '@/components/ui/drawer'
import { storeToRefs } from 'pinia'
import { useWeb5Store } from '@/stores/web5'

const isOpen = ref(false)

const { connect, walletConnect, isWeb5ConnectLoading, isWeb5WalletConnectLoading } =
useWeb5Connection()
const { web5 } = storeToRefs(useWeb5Store())

const truncateString = (data: string) => `${data.substring(0, 7)}...${data.slice(data.length - 4)}`
</script>

<template>
<p v-if="web5">hi, {{ truncateString(web5.did) }}</p>
<Drawer v-else v-model:open="isOpen">
<DrawerTrigger as-child>
<Button variant="outline" class="w-full dark:bg-zinc-950 dark:text-white">
<Link2Icon class="w-4 h-4 mr-2" />
Connect
</Button>
</DrawerTrigger>
<DrawerContent class="dark:bg-zinc-950 dark:text-white">
<DrawerHeader class="flex flex-col items-center">
<DrawerTitle>Connect to Web5</DrawerTitle>
<DrawerDescription>Select how you'd like to connect below.</DrawerDescription>
</DrawerHeader>
<div class="flex flex-col gap-2 p-4 items-center">
<Button
variant="outline"
:disabled="isWeb5ConnectLoading || isWeb5WalletConnectLoading"
class="lg:w-1/3 w-full dark:bg-zinc-950 dark:text-white"
@click="connect"
>
<ReloadIcon v-if="isWeb5ConnectLoading" class="w-4 h-4 mr-2 animate-spin" />
<div v-else class="flex items-center">
<Link2Icon class="w-4 h-4 mr-2" /> Local Agent Connect
</div>
</Button>

<Button
variant="outline"
:disabled="isWeb5ConnectLoading || isWeb5WalletConnectLoading"
class="lg:w-1/3 w-full dark:bg-zinc-950 dark:text-white"
@click="walletConnect"
>
<ReloadIcon v-if="isWeb5WalletConnectLoading" class="w-4 h-4 mr-2 animate-spin" />
<div v-else class="flex items-center">
<LinkBreak2Icon class="w-4 h-4 mr-2" /> Wallet Connect
</div>
</Button>
</div>
<DrawerFooter>
<DrawerClose as-child>
<Button
variant="outline"
class="lg:w-1/3 w-full place-self-center bg-red-500 text-white dark:bg-red-500 dark:text-white"
><Cross1Icon class="w-4 h-4 mr-2" /> Cancel
</Button>
</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>
</template>
19 changes: 19 additions & 0 deletions javascript/dwa-starter-vue/src/components/ui/drawer/Drawer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script lang="ts" setup>
import type { DrawerRootEmits, DrawerRootProps } from 'vaul-vue'
import { DrawerRoot } from 'vaul-vue'
import { useForwardPropsEmits } from 'radix-vue'

const props = withDefaults(defineProps<DrawerRootProps>(), {
shouldScaleBackground: true,
})

const emits = defineEmits<DrawerRootEmits>()

const forwarded = useForwardPropsEmits(props, emits)
</script>

<template>
<DrawerRoot v-bind="forwarded">
<slot />
</DrawerRoot>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<script lang="ts" setup>
import { DrawerContent, DrawerPortal } from 'vaul-vue'
import type { DialogContentEmits, DialogContentProps } from 'radix-vue'
import { useForwardPropsEmits } from 'radix-vue'
import type { HtmlHTMLAttributes } from 'vue'
import DrawerOverlay from './DrawerOverlay.vue'
import { cn } from '@/lib/utils'

const props = defineProps<DialogContentProps & { class?: HtmlHTMLAttributes['class'] }>()
const emits = defineEmits<DialogContentEmits>()

const forwarded = useForwardPropsEmits(props, emits)
</script>

<template>
<DrawerPortal>
<DrawerOverlay />
<DrawerContent
v-bind="forwarded" :class="cn(
'fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border border-slate-200 bg-white dark:border-slate-800 dark:bg-slate-950',
props.class,
)"
>
<div class="mx-auto mt-4 h-2 w-[100px] rounded-full bg-slate-100 dark:bg-slate-800" />
<slot />
</DrawerContent>
</DrawerPortal>
</template>
Loading
Loading