-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: list of releases can now be seen at the top (#2480)
- Loading branch information
Showing
35 changed files
with
455 additions
and
194 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="flex items-center justify-end gap-4"> | ||
<template v-if="config.pages"> | ||
<router-link | ||
:to="{ name: 'content-id', params: { id: page.id } }" | ||
:title="page.title" | ||
v-for="page in config.pages" | ||
:key="page.id" | ||
class="link-primary" | ||
> | ||
{{ page.title }} | ||
</router-link> | ||
</template> | ||
|
||
<dropdown class="dropdown-end" @closed="latestTag = latest?.tag ?? config.version"> | ||
<template #trigger> | ||
<mdi:announcement class="h-6 w-6 -rotate-12" /> | ||
<span | ||
class="absolute right-px top-0 h-2 w-2 rounded-full bg-red" | ||
v-if="hasUpdate && latestTag != latest?.tag" | ||
></span> | ||
</template> | ||
<template #content> | ||
<div class="w-72"> | ||
<releases /> | ||
</div> | ||
</template> | ||
</dropdown> | ||
|
||
<dropdown class="dropdown-end" v-if="config.user"> | ||
<template #trigger> | ||
<img class="h-8 w-8 max-w-none rounded-full p-1 ring-2 ring-base-content/50" :src="config.user.avatar" /> | ||
</template> | ||
<template #content> | ||
<div class="p-2"> | ||
<div class="font-bold"> | ||
{{ config.user.name }} | ||
</div> | ||
<div class="text-sm font-light"> | ||
{{ config.user.email }} | ||
</div> | ||
</div> | ||
<ul class="menu mt-4 p-0"> | ||
<li v-if="config.authProvider === 'simple'"> | ||
<button @click.prevent="logout()" class="text-primary">{{ $t("button.logout") }}</button> | ||
</li> | ||
</ul> | ||
</template> | ||
</dropdown> | ||
</div> | ||
</template> | ||
<script lang="ts" setup> | ||
async function logout() { | ||
await fetch(withBase("/api/token"), { | ||
method: "DELETE", | ||
}); | ||
location.reload(); | ||
} | ||
const { hasUpdate, latest } = useReleases(); | ||
const latestTag = useStorage("DOZZLE_LATEST_TAG", config.version); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<template> | ||
<ul class="space-y-4 p-2"> | ||
<li v-for="release in releases" v-if="releases?.length"> | ||
<div class="flex items-baseline gap-1"> | ||
<carbon:warning class="h-4.25 w-4.25 self-center stroke-orange" v-if="release.breaking > 0" /> | ||
<a :href="release.htmlUrl" class="link-primary text-lg font-bold" target="_blank" rel="noreferrer noopener"> | ||
{{ release.name }} | ||
</a> | ||
<span class="ml-1 text-xs"><distance-time :date="new Date(release.createdAt)" /></span> | ||
<tag class="ml-auto bg-red px-1 py-1 text-xs" v-if="release.tag === latest?.tag"> | ||
{{ $t("releases.latest") }} | ||
</tag> | ||
</div> | ||
<div class="text-sm text-base-content/80"> | ||
{{ summary(release) }} | ||
</div> | ||
</li> | ||
<li v-else> | ||
<div class="text-sm text-base-content/80"> | ||
{{ $t("releases.no_releases") }} | ||
</div> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const { releases, latest } = useReleases(); | ||
const { t } = useI18n(); | ||
function summary(release: { features: number; bugFixes: number; breaking: number }) { | ||
if (release.features > 0 && release.bugFixes > 0 && release.breaking > 0) { | ||
return t("releases.three_parts", { | ||
first: t("releases.breaking", { count: release.breaking }), | ||
second: t("releases.features", { count: release.features }), | ||
third: t("releases.bugFixes", { count: release.bugFixes }), | ||
}); | ||
} | ||
if (release.features > 0 && release.bugFixes > 0) { | ||
return t("releases.two_parts", { | ||
first: t("releases.features", { count: release.features }), | ||
second: t("releases.bugFixes", { count: release.bugFixes }), | ||
}); | ||
} | ||
if (release.features > 0 && release.breaking > 0) { | ||
return t("releases.two_parts", { | ||
first: t("releases.features", { count: release.features }), | ||
second: t("releases.breaking", { count: release.breaking }), | ||
}); | ||
} | ||
if (release.bugFixes > 0 && release.breaking > 0) { | ||
return t("releases.two_parts", { | ||
first: t("releases.bugFixes", { count: release.bugFixes }), | ||
second: t("releases.breaking", { count: release.breaking }), | ||
}); | ||
} | ||
if (release.features > 0) { | ||
return t("releases.features", { count: release.features }); | ||
} | ||
if (release.bugFixes > 0) { | ||
return t("releases.bugFixes", { count: release.bugFixes }); | ||
} | ||
if (release.breaking > 0) { | ||
return t("releases.breaking", { count: release.breaking }); | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,25 @@ | ||
<template> | ||
<details class="dropdown" ref="details" v-on-click-outside="close"> | ||
<summary class="btn btn-primary flex-nowrap" v-bind="$attrs"> | ||
<slot name="trigger"> {{ values[modelValue] ?? defaultLabel }} <carbon:caret-down /></slot> | ||
</summary> | ||
<ul class="menu dropdown-content rounded-box z-50 mt-1 w-52 border border-base-content/20 bg-base p-2 shadow"> | ||
<slot> | ||
<li v-for="item in options"> | ||
<a @click="modelValue = item.value"> | ||
<mdi:check class="w-4" v-if="modelValue == item.value" /> | ||
<div v-else class="w-4"></div> | ||
{{ item.label }} | ||
</a> | ||
</li> | ||
</slot> | ||
</ul> | ||
</details> | ||
<div class="dropdown"> | ||
<label tabindex="0" class="btn btn-circle btn-sm" @mousedown="checkAndCloseDropDown($event)" @blur="closed()"> | ||
<slot name="trigger"></slot> | ||
</label> | ||
<div | ||
tabindex="0" | ||
class="min-w-52 dropdown-content rounded-box z-50 mt-1 border border-base-content/20 bg-base p-2 shadow" | ||
> | ||
<slot name="content"></slot> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { vOnClickOutside } from "@vueuse/components"; | ||
type DropdownItem = { | ||
label: string; | ||
value: string; | ||
}; | ||
const { options = [], defaultLabel = "" } = defineProps<{ options?: DropdownItem[]; defaultLabel?: string }>(); | ||
const { modelValue } = defineModels<{ | ||
modelValue: string; | ||
}>(); | ||
const values = computed(() => | ||
options.reduce( | ||
(acc, curr) => { | ||
acc[curr.value] = curr.label; | ||
return acc; | ||
}, | ||
{} as Record<string, string>, | ||
), | ||
); | ||
const details = ref<HTMLElement | null>(null); | ||
const close = () => details.value?.removeAttribute("open"); | ||
watch(modelValue, () => close()); | ||
<script setup lang="ts"> | ||
const closed = defineEmit(); | ||
function checkAndCloseDropDown(e: MouseEvent) { | ||
const target = e.currentTarget as HTMLElement; | ||
if (target?.matches(":focus")) { | ||
setTimeout(() => target.blur(), 0); | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<details class="dropdown" ref="details" v-on-click-outside="close"> | ||
<summary class="btn btn-primary flex-nowrap" v-bind="$attrs"> | ||
<slot name="trigger"> {{ values[modelValue] ?? defaultLabel }} <carbon:caret-down /></slot> | ||
</summary> | ||
<ul class="menu dropdown-content rounded-box z-50 mt-1 w-52 border border-base-content/20 bg-base p-2 shadow"> | ||
<slot> | ||
<li v-for="item in options"> | ||
<a @click="modelValue = item.value"> | ||
<mdi:check class="w-4" v-if="modelValue == item.value" /> | ||
<div v-else class="w-4"></div> | ||
{{ item.label }} | ||
</a> | ||
</li> | ||
</slot> | ||
</ul> | ||
</details> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { vOnClickOutside } from "@vueuse/components"; | ||
type DropdownItem = { | ||
label: string; | ||
value: string; | ||
}; | ||
const { options = [], defaultLabel = "" } = defineProps<{ options?: DropdownItem[]; defaultLabel?: string }>(); | ||
const { modelValue } = defineModels<{ | ||
modelValue: string; | ||
}>(); | ||
const values = computed(() => | ||
options.reduce( | ||
(acc, curr) => { | ||
acc[curr.value] = curr.label; | ||
return acc; | ||
}, | ||
{} as Record<string, string>, | ||
), | ||
); | ||
const details = ref<HTMLElement | null>(null); | ||
const close = () => details.value?.removeAttribute("open"); | ||
watch(modelValue, () => close()); | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.