Merge pull request #889 from EBEN4REAL/custom-tag-colors

Custom tag colors
This commit is contained in:
vmatsiiako
2023-08-23 21:03:46 -07:00
committed by GitHub
18 changed files with 443 additions and 137 deletions
+5 -2
View File
@@ -7,7 +7,7 @@ import {
CreateTagRes,
DeleteTagDTO,
DeleteWsTagRes,
UserWsTags
UserWsTags,
} from "./types";
const workspaceTags = {
@@ -30,13 +30,15 @@ export const useGetWsTags = (workspaceID: string) => {
});
}
export const useCreateWsTag = () => {
const queryClient = useQueryClient();
return useMutation<CreateTagRes, {}, CreateTagDTO>({
mutationFn: async ({ workspaceID, tagName, tagSlug }) => {
mutationFn: async ({ workspaceID, tagName, tagColor, tagSlug }) => {
const { data } = await apiRequest.post(`/api/v2/workspace/${workspaceID}/tags`, {
name: tagName,
tagColor: tagColor || "",
slug: tagSlug
})
return data;
@@ -47,6 +49,7 @@ export const useCreateWsTag = () => {
});
};
export const useDeleteWsTag = () => {
const queryClient = useQueryClient();
+19 -1
View File
@@ -4,6 +4,7 @@ export type WsTag = {
_id: string;
name: string;
slug: string;
tagColor?: string;
workspace: string;
createdAt: string;
updatedAt: string;
@@ -16,6 +17,7 @@ export type CreateTagDTO = {
workspaceID: string;
tagSlug: string;
tagName: string;
tagColor: string;
};
export type CreateTagRes = {
@@ -23,6 +25,7 @@ export type CreateTagRes = {
slug: string;
workspace: string;
createdAt: string;
tagColor?: string;
user: string;
_id: string;
};
@@ -36,4 +39,19 @@ export type DeleteWsTagRes = {
createdAt: string;
user: string;
_id: string;
};
};
export type SecretTags = {
id: string;
_id: string;
slug: string;
tagColor: string;
}
export type TagColor = {
id: number;
hex: string
rgba: string
name: string
selected: boolean
}