|
@@ -2,9 +2,9 @@ import type { SpecialTag, Track } from "@/types";
|
|
|
|
|
|
export default function useTrackColor() {
|
|
export default function useTrackColor() {
|
|
const colors = ["red", "blue", "green"];
|
|
const colors = ["red", "blue", "green"];
|
|
- const colorMap: Record<number, Record<number, string>> = {};
|
|
|
|
|
|
+ const colorMap: Record<number, string> = {};
|
|
|
|
|
|
- function addTrackColorAttr(tList: Track[], groupNumber: number): Track[] {
|
|
|
|
|
|
+ function addTrackColorAttr(tList: Track[]): Track[] {
|
|
let userIds: (number | undefined)[] = tList
|
|
let userIds: (number | undefined)[] = tList
|
|
.map((v) => v.userId)
|
|
.map((v) => v.userId)
|
|
.filter((x) => !!x);
|
|
.filter((x) => !!x);
|
|
@@ -16,12 +16,10 @@ export default function useTrackColor() {
|
|
if (item.headerMarkScore) {
|
|
if (item.headerMarkScore) {
|
|
item.color = "green";
|
|
item.color = "green";
|
|
} else {
|
|
} else {
|
|
- if (!colorMap[groupNumber]) colorMap[groupNumber] = {};
|
|
|
|
- if (!colorMap[groupNumber][uid]) {
|
|
|
|
- colorMap[groupNumber][uid] =
|
|
|
|
- colors[Object.keys(colorMap[groupNumber]).length] || "green";
|
|
|
|
|
|
+ if (!colorMap[uid]) {
|
|
|
|
+ colorMap[uid] = colors[Object.keys(colorMap).length] || "green";
|
|
}
|
|
}
|
|
- item.color = colorMap[groupNumber][uid];
|
|
|
|
|
|
+ item.color = colorMap[uid];
|
|
}
|
|
}
|
|
item.isByMultMark = isByMultMark;
|
|
item.isByMultMark = isByMultMark;
|
|
return item;
|
|
return item;
|
|
@@ -31,10 +29,7 @@ export default function useTrackColor() {
|
|
|
|
|
|
function addSpecialTrackColorAttr(tList: SpecialTag[]): SpecialTag[] {
|
|
function addSpecialTrackColorAttr(tList: SpecialTag[]): SpecialTag[] {
|
|
return tList.map((item) => {
|
|
return tList.map((item) => {
|
|
- item.color =
|
|
|
|
- colorMap[item.groupNumber] && colorMap[item.groupNumber][item.markerId]
|
|
|
|
- ? colorMap[item.groupNumber][item.markerId]
|
|
|
|
- : "green";
|
|
|
|
|
|
+ item.color = colorMap[item.markerId] || "green";
|
|
return item;
|
|
return item;
|
|
});
|
|
});
|
|
}
|
|
}
|