-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
185 additions
and
11 deletions.
There are no files selected for viewing
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,17 @@ | ||
<script setup lang="ts"> | ||
import ProvideTaskTemplateContext from './components/ProvideTaskTemplateContext.vue'; | ||
import TaskTemplate from './TaskTemplate.vue'; | ||
defineProps<{commitId:string, taskTemplateId:string}>() | ||
</script> | ||
|
||
<template> | ||
<main class="panel"> | ||
<ProvideTaskTemplateContext :commitId="commitId"> | ||
<TaskTemplate :taskTemplateId="taskTemplateId" /> | ||
</ProvideTaskTemplateContext> | ||
</main> | ||
</template> | ||
|
||
<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,42 @@ | ||
<script setup lang="ts"> | ||
import { inject, Ref, computed, } from 'vue' | ||
import { TaskContext, TaskListTemplate, } from '@/sources/ability'; | ||
import AnyTask from '@/gamecore/AnyTask.vue'; | ||
import ShowContext from './components/ShowContext.vue'; | ||
import BlockLayout from '@/components/BlockLayout.vue'; | ||
const props = defineProps<{taskTemplateId:string}>() | ||
const taskContext = inject('taskContext') as Ref<TaskContext> | ||
const taskTemplate = computed<TaskListTemplate>(() => taskContext.value.TaskListTemplates?.[props.taskTemplateId]) | ||
</script> | ||
|
||
<template> | ||
<header> | ||
<h1><span class="pretitle">Task Template:</span> {{ taskTemplateId }}</h1> | ||
</header> | ||
<section :key="taskTemplateId"> | ||
|
||
<template v-if="taskTemplate"> | ||
|
||
<template v-if="taskTemplate.TaskList"> | ||
<h2>Tasks</h2> | ||
<template v-for="task in taskTemplate.TaskList"> | ||
<AnyTask :node="task" /> | ||
</template> | ||
</template> | ||
|
||
<h2>Context</h2> | ||
<BlockLayout :source="taskTemplate"> | ||
<span class="flow">Task Template Data</span> | ||
</BlockLayout> | ||
<ShowContext /> | ||
|
||
</template> | ||
<span v-else class="minor">(Task Template {{ taskTemplateId }} not found)</span> | ||
|
||
</section> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
39 changes: 39 additions & 0 deletions
39
src/views/abilities/components/ProvideTaskTemplateContext.vue
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,39 @@ | ||
<script setup lang="ts"> | ||
import { ref, watch, provide, } from 'vue'; | ||
import { ExpressionContext } from '@/sources/gamecore'; | ||
import { getTaskContext, TaskContext, TaskContextType, } from '@/sources/ability'; | ||
const props = defineProps<{commitId:string, abilityRouteName?:string, modifierRouteName?:string}>() | ||
const expressionContext = ref<ExpressionContext>(await getExpressionContext()) | ||
const taskContext = ref<TaskContext>(await getTaskContext(props.commitId, TaskContextType.TaskTemplate)) | ||
watch(props, async () => | ||
{ | ||
expressionContext.value = await getExpressionContext() | ||
taskContext.value = await getTaskContext(props.commitId, TaskContextType.TaskTemplate) | ||
}) | ||
async function getExpressionContext() | ||
{ | ||
const context:ExpressionContext = | ||
{ | ||
Params: {}, | ||
AbilityHashValues: {}, | ||
AbilityDynamicValues: {}, | ||
} | ||
return context | ||
} | ||
provide('expressionContext', expressionContext) | ||
provide('taskContext', taskContext) | ||
provide('createAbilityRoute', (abilityId:string) : object => { return { name: props.abilityRouteName ?? 'ability', params:{ commitId: props.commitId, abilityId: abilityId, } }}) | ||
provide('createModifierRoute', (modifierId:string) : object => { return { name: props.modifierRouteName ?? 'modifier', params:{ commitId: props.commitId, modifierId: modifierId, } }}) | ||
</script> | ||
|
||
<template> | ||
<slot></slot> | ||
</template> | ||
|
||
<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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import { ref, computed, inject, Ref, } from 'vue' | ||
import { RouterLink } from 'vue-router'; | ||
import { TaskContext, TaskContextType, getTaskContext, TaskListTemplate } from '@/sources/ability'; | ||
import NavItem from '@/components/NavItem.vue' | ||
const commitId = inject<string>('commitId') as string | ||
const search = inject<Ref<string>>('search') as Ref<string> | ||
const taskContext = ref<TaskContext>(await getTaskContext(commitId, TaskContextType.TaskTemplate)) | ||
const taskTemplatesSearchResults = computed(() => allTaskTemplates()) | ||
function allTaskTemplates() : TaskListTemplate[] | ||
{ | ||
return Object.values(taskContext.value.TaskListTemplates) | ||
.filter(v => v.Name.toLowerCase().includes(search.value.toLowerCase())) | ||
.sort((a, b) => a.Name > b.Name ? 1 : -1) | ||
} | ||
</script> | ||
|
||
<template> | ||
<NavItem v-for="taskTemplate in taskTemplatesSearchResults" :key="taskTemplate.Name"> | ||
<RouterLink :to="{ name:'tasktemplate', params:{ commitId: commitId, taskTemplateId: taskTemplate.Name }}"> | ||
<span :title="taskTemplate.Name">{{ taskTemplate.Name }}</span> | ||
</RouterLink> | ||
</NavItem> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |