Change lineStyle by unlocked,delete docker swagger

This commit is contained in:
Annie Huang committed 2023-11-20 14:41:03 +08:00
1 parent 5d353b71e2
commit 12c6e493a5
2 files changed
+10 -35

No files matched your search

+10 -26
View File
@@ -3,7 +3,7 @@
<img <img
src="../img/catelogbg.svg" src="../img/catelogbg.svg"
alt="bg" alt="bg"
class="p-2 stroke-2 scale-120 justify-center items-center" class="p-2 stroke-2 scale-y-120 justify-center items-center"
/> />
<h1 <h1
class="text-text-primary text-xl p-2.5 absolute w-fit z-2 font-mono font-bold flex flax-wrap" class="text-text-primary text-xl p-2.5 absolute w-fit z-2 font-mono font-bold flex flax-wrap"
@@ -48,7 +48,6 @@ async function getQuests() {
async function getProgress() { async function getProgress() {
try { try {
const res = await api.get('/users/me') const res = await api.get('/users/me')
console.log(res.data.progress)
return res.data.progress return res.data.progress
} catch (err) { } catch (err) {
console.error(err) console.error(err)
@@ -87,31 +86,13 @@ const genOption = (nodes, edges) => ({
color: 'gray', color: 'gray',
opacity: 4, opacity: 4,
curveness: 0.08, curveness: 0.08,
// type: 'dashed',
type: (params) => {
const {
data: { unlocked },
} = params
console.log(unlocked)
switch (unlocked) {
case true:
return 'line'
default:
return 'dashed'
}
},
}, },
itemStyle: { itemStyle: {
color: (params) => { color: (params) => {
const { const {
data: { completed }, data: { completed },
} = params } = params
switch (completed) { return completed ? '#ADADB5' : '#454552'
case true:
return '#ADADB5'
default:
return '#454552'
}
}, },
}, },
}, },
@@ -120,7 +101,6 @@ const genOption = (nodes, edges) => ({
function getOption(quests, progress) { function getOption(quests, progress) {
const dag = new DAG(quests) const dag = new DAG(quests)
console.log(progress)
const nodes = dag.getNodes().map((node) => ({ const nodes = dag.getNodes().map((node) => ({
id: node._id, id: node._id,
@@ -130,12 +110,17 @@ function getOption(quests, progress) {
completed: progress[node._id]?.completed || false, completed: progress[node._id]?.completed || false,
unlocked: node.requirements.every((req) => progress[req]?.completed), unlocked: node.requirements.every((req) => progress[req]?.completed),
})) }))
const lineAppearence = (node) => {
console.log(nodes) const { unlocked } = node
return {
type: unlocked ? 'line' : 'dashed',
color: unlocked ? '#ADADB5' : '#454552',
}
}
const edges = dag.getEdgesArray().map((edge) => ({ const edges = dag.getEdgesArray().map((edge) => ({
source: edge[0], source: edge[0],
target: edge[1], target: edge[1],
lineStyle: lineAppearence(nodes.find((node) => node.id === edge[1])),
})) }))
return genOption(nodes, edges) return genOption(nodes, edges)
} }
@@ -144,7 +129,6 @@ const router = useRouter()
const toast = useToast() const toast = useToast()
function initChart(option) { function initChart(option) {
console.log('initChart', chartContainer.value)
chartInstance = init(chartContainer.value) chartInstance = init(chartContainer.value)
chartInstance.setOption(option) chartInstance.setOption(option)
chartInstance.on('click', (params) => { chartInstance.on('click', (params) => {
-9
View File
@@ -72,15 +72,6 @@ services:
volumes: volumes:
- ./data:/data/db - ./data:/data/db
swagger:
image: swaggerapi/swagger-editor:latest
ports:
- 8080:8080
volumes:
- ./server/swagger.yaml:/tmp/swagger.yaml
environment:
- SWAGGER_FILE=/tmp/swagger.yaml
base: base:
image: lancatlin/linux-odyssey:base image: lancatlin/linux-odyssey:base
build: build: