You've already forked AstralRinth
forked from didirus/AstralRinth
feat: ssr fixes + switch project page to tanstack (#5192)
* feat: ssr fixes * feat: lazy load non-core data * feat: ssr timing debugging * feat: go back to all parallel * feat: migrate to DI + set up mutators * feat: remove double get versions request, only call v3 * refactor: [version].vue page to use composition API and typescript * feat: gallery.vue start * fix: remove left behind console log * fix: type issues + gallery * fix: versionsummary modal + version page direct join * fix: projectRaw guard * fix: currentMember val fix * fix: actualProjectType * fix: vers summary link same page * fix: lint --------- Co-authored-by: tdgao <mr.trumgao@gmail.com>
This commit is contained in:
@@ -17,14 +17,15 @@
|
||||
</a>
|
||||
</ButtonStyled>
|
||||
<ButtonStyled circular>
|
||||
<nuxt-link
|
||||
:to="`/project/${props.version.project_id}/version/${props.version.id}`"
|
||||
<button
|
||||
class="min-w-0"
|
||||
aria-label="Open project page"
|
||||
@click="emit('onNavigate')"
|
||||
aria-label="View version"
|
||||
@click="
|
||||
emit('onNavigate', `/project/${props.version.project_id}/version/${props.version.id}`)
|
||||
"
|
||||
>
|
||||
<ExternalIcon aria-hidden="true" />
|
||||
</nuxt-link>
|
||||
</button>
|
||||
</ButtonStyled>
|
||||
</div>
|
||||
</template>
|
||||
@@ -45,5 +46,8 @@ const downloadUrl = computed(() => {
|
||||
return primary.url
|
||||
})
|
||||
|
||||
const emit = defineEmits(['onDownload', 'onNavigate'])
|
||||
const emit = defineEmits<{
|
||||
onDownload: []
|
||||
onNavigate: [url: string]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@@ -1,16 +1,36 @@
|
||||
import type { Labrinth } from '@modrinth/api-client/src/modules/types'
|
||||
// TODO: api client this shit
|
||||
import type { TeamMember } from '@modrinth/utils'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
import { createContext } from '.'
|
||||
|
||||
export interface ProjectPageContext {
|
||||
// Data refs
|
||||
projectV2: Ref<Labrinth.Projects.v2.Project>
|
||||
projectV3: Ref<Labrinth.Projects.v3.Project>
|
||||
currentMember: Ref<Labrinth.Projects.v3.TeamMember | null>
|
||||
allMembers: Ref<Labrinth.Projects.v3.TeamMember[]>
|
||||
organization: Ref<Labrinth.Projects.v3.Organization | null>
|
||||
// Lazy version loading (client-side only)
|
||||
versions: Ref<Labrinth.Versions.v2.Version[] | null>
|
||||
versionsLoading: Ref<boolean>
|
||||
// Lazy dependencies loading (client-side only)
|
||||
dependencies: Ref<Labrinth.Projects.v2.DependencyInfo | null>
|
||||
dependenciesLoading: Ref<boolean>
|
||||
|
||||
// Refresh functions (invalidate + refetch)
|
||||
refreshProject: () => Promise<void>
|
||||
refreshVersions: () => Promise<void>
|
||||
currentMember: Ref<TeamMember>
|
||||
refreshMembers: () => Promise<void>
|
||||
refreshOrganization: () => Promise<void>
|
||||
|
||||
// Lazy loading
|
||||
loadVersions: () => Promise<void>
|
||||
loadDependencies: () => Promise<void>
|
||||
|
||||
// Mutation functions
|
||||
patchProject: (data: Record<string, unknown>, quiet?: boolean) => Promise<boolean>
|
||||
patchIcon: (icon: File) => Promise<boolean>
|
||||
setProcessing: () => Promise<void>
|
||||
}
|
||||
|
||||
export const [injectProjectPageContext, provideProjectPageContext] =
|
||||
|
||||
Reference in New Issue
Block a user