File tree Expand file tree Collapse file tree 5 files changed +16
-10
lines changed
Expand file tree Collapse file tree 5 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 11import type { MaybeRefOrGetter , Ref } from 'vue'
22import type { ChangeLog } from '../../types'
33import { computedAsync } from '@vueuse/core'
4- import { toRef } from 'vue'
4+ import { computed } from 'vue'
55import { useAddonGitLogConfig } from '../options'
66import { useGitLog } from './gitlog'
77
@@ -10,7 +10,7 @@ export function useChangeLog(_path?: MaybeRefOrGetter<string>): Ref<ChangeLog[]>
1010 const gitLogOptions = useAddonGitLogConfig ( )
1111
1212 if ( gitLogOptions . value . contributor ?. mode !== 'api' )
13- return toRef ( [ ] )
13+ return computed ( ( ) => gitLog . value . changeLog )
1414
1515 const contributors = computedAsync < ChangeLog [ ] > (
1616 async ( ) => {
Original file line number Diff line number Diff line change 11import type { MaybeRefOrGetter , Ref } from 'vue'
22import type { Contributor } from '../../types'
33import { computedAsync } from '@vueuse/core'
4- import { toRef , toValue } from 'vue'
4+ import { computed , toValue } from 'vue'
55import { parseGithubUrl } from '../../utils'
66import { useAddonGitLogConfig } from '../options'
77import { fetchContributors } from '../services'
@@ -12,7 +12,7 @@ export function useContributor(path?: MaybeRefOrGetter<string>): Ref<Contributor
1212 const gitLogOptions = useAddonGitLogConfig ( )
1313
1414 if ( gitLogOptions . value . contributor ?. mode !== 'api' )
15- return toRef ( [ ] )
15+ return computed ( ( ) => gitLog . value . contributors )
1616
1717 const contributors = computedAsync < Contributor [ ] > (
1818 async ( ) => {
Original file line number Diff line number Diff line change @@ -15,16 +15,20 @@ const contributors = computed(() => props.contributors || gitLogContributor?.val
1515<template >
1616 <ul class =" git-log-contributor" flex =" ~ wrap gap-2" pt-2 >
1717 <li v-for =" (contributor, index) in contributors" :key =" index" flex =" ~ items-center gap-2" >
18- <span class =" contributor-avatar" >
19- <a :href =" contributor.github || ''" target =" _blank" aria-label =" Contributor image" :title =" contributor.email" >
20- <img :src =" contributor.avatar" width =" 32" height =" 32" :alt =" contributor.name" loading =" lazy" decoding =" async" rounded-full >
21- </a >
18+ <span class =" contributor-avatar" :title =" contributor.email" >
19+ <img
20+ :src =" contributor.avatar" width =" 32" height =" 32" aria-label =" Contributor image"
21+ :alt =" contributor.name" loading =" lazy" decoding =" async" rounded-full
22+ >
2223 </span >
2324
2425 <span class =" contributor-name" >
25- <a :href =" contributor.github || '' " target = " _blank " :title =" contributor.email " >
26+ <a v-if =" contributor? .github" :href = " contributor.github " :title =" contributor.github " target = " _blank " >
2627 {{ contributor.name }}
2728 </a >
29+ <template v-else >
30+ {{ contributor.name }}
31+ </template >
2832 </span >
2933 </li >
3034 </ul >
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ export const addonGitLog = defineValaxyAddon<GitLogOptions>(options => ({
1515 name : pkg . name ,
1616 enable : true ,
1717 options : {
18- ...options ,
1918 contributor : {
2019 mode : 'api' ,
2120 } ,
21+ ...options ,
2222 } ,
2323
2424 async setup ( valaxy ) {
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ export interface GitLogOptions {
99}
1010
1111export interface Contributor extends ContributorInfo {
12+ name : string
1213 email : string
1314 avatar : string
15+ count : number
1416 github ?: string | null
1517}
1618
You can’t perform that action at this time.
0 commit comments