-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: BorderColor option for dynamic section #2252
base: dev
Are you sure you want to change the base?
Conversation
Here's the code health analysis summary for commits Analysis Summary
|
Hi, the code I just committed keeps the options for a dynamic section but doesn't save it once exiting edit mode. I didn't want to try and figure out how to save it to the SQL document because I am not that familiar with the language and didn't want to accidentally break something or jerry-rig a poor solution. Could someone who knows how I should implement it please guide me. Thanks |
Sure! export const sections = sqliteTable("section", {
id: text().notNull().primaryKey(),
boardId: text()
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
kind: text().$type<SectionKind>().notNull(),
xOffset: int().notNull(),
yOffset: int().notNull(),
width: int(),
height: int(),
name: text(),
parentSectionId: text().references((): AnySQLiteColumn => sections.id, {
onDelete: "cascade",
}),
}); You can simply add a new field for the border-color and make it nullable (not using notNull). So for sqlite something like: export const sections = sqliteTable("section", {
id: text().notNull().primaryKey(),
boardId: text()
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
kind: text().$type<SectionKind>().notNull(),
xOffset: int().notNull(),
yOffset: int().notNull(),
width: int(),
height: int(),
name: text(),
borderColor: text(), // would be varchar({length: 7}) for mysql (7 for hex in format "#000000")
parentSectionId: text().references((): AnySQLiteColumn => sections.id, {
onDelete: "cascade",
}),
}); Then you can create a db migration and run it locally: Useful for you are |
Will I also need to edit the Something like this? await transaction
.update(schema.sections)
.set({
yOffset: section.yOffset,
xOffset: section.xOffset,
height: prev?.kind === "dynamic" && "height" in section ? section.height : null,
width: prev?.kind === "dynamic" && "width" in section ? section.width : null,
parentSectionId: prev?.kind === "dynamic" && "parentSectionId" in section ? section.parentSectionId : null,
borderColor: prev?.kind === "dynamic" && section.kind === "dynamic" ? section.borderColor : null, // <--
name: prev?.kind === "category" && "name" in section ? section.name : null,
})
.where(eq(sections.id, section.id)); |
Yes exactly 👍 |
doesn't include DB SQL migration files due to not being upto date
When editing the border colour option and saving the board. It doesn't apply automatically, the user will need to refresh the page. Does anyone know how I can make it refresh the css automatically? |
Homarr
Thank you for your contribution. Please ensure that your pull request meets the following pull request:
pnpm buid
, autofix withpnpm format:fix
)dev
branchx
,y
,i
or any abbrevation)Closes #2235