feat: Collection Icons (#1281)

* wip: Working for creation, and display

* feat: IconPicker

* fix

* feat: Invert collection icon color when dark in dark mode

* Improve readability of dropdown menus in dark mode
Suggest icon based on collection name

* Add additional icons
Tweaks and final polish

* fix: Write default icon as empty icon column

* feat: Improve icon selection logic
add more keywords
Improve icon coloring when selected and in dark mode

* lint

* lint
This commit is contained in:
Tom Moor
2020-06-19 17:18:03 -07:00
committed by GitHub
parent f3ea02fdd0
commit d864e228e7
21 changed files with 417 additions and 190 deletions

View File

@ -19,6 +19,7 @@ const Collection = sequelize.define(
urlId: { type: DataTypes.STRING, unique: true },
name: DataTypes.STRING,
description: DataTypes.STRING,
icon: DataTypes.STRING,
color: DataTypes.STRING,
private: DataTypes.BOOLEAN,
maintainerApprovalRequired: DataTypes.BOOLEAN,
@ -46,6 +47,12 @@ const Collection = sequelize.define(
}
);
Collection.addHook('beforeSave', async model => {
if (model.icon === 'collection') {
model.icon = null;
}
});
// Class methods
Collection.associate = models => {