Skip to content
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

style: created custom tagify scss file and updated gulp file #10063

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
73a497d
created custom tagify scss file and updated gulp file
IsaiahLevy Mar 31, 2024
6a90691
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy Apr 1, 2024
aa23cad
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy Apr 2, 2024
9a0467f
styling: update tagify styles
IsaiahLevy Apr 3, 2024
78a1ff6
Merge branch 'openfoodfacts:main' into add-tagify-scss-customization
IsaiahLevy Apr 4, 2024
ddae13e
Merge pull request #2 from openfoodfacts/main
tchen0125 Apr 6, 2024
3fad730
Merge branch 'openfoodfacts:main' into main
andrewhuanggg Apr 8, 2024
8755404
Merge branch 'openfoodfacts:main' into main
andrewhuanggg Apr 11, 2024
336c50d
Merge branch 'openfoodfacts:main' into add-tagify-scss-customization
tchen0125 Apr 11, 2024
5d562cc
created custom tagify scss file and updated gulp file
IsaiahLevy Mar 31, 2024
934d4f0
styling: update tagify styles
IsaiahLevy Apr 3, 2024
cbc1ae6
fixing tagify
IsaiahLevy Apr 11, 2024
30e873f
Merge branch 'main' of https://github.com/ossd-s24/openfoodfacts-serv…
IsaiahLevy Apr 11, 2024
752a5cf
fixing tagify rules
IsaiahLevy Apr 11, 2024
d4cef45
Merge remote-tracking branch 'upstream/main' into add-tagify-scss-cus…
IsaiahLevy Apr 12, 2024
ddbd4a9
resolving merge conflicts
IsaiahLevy Apr 12, 2024
2690f67
removing unrelate changes and updating custom-tagify
IsaiahLevy Apr 18, 2024
bc58995
Merge branch 'main' of https://github.com/openfoodfacts/openfoodfacts…
IsaiahLevy Apr 18, 2024
cdb3458
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy Apr 19, 2024
4ecf12b
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy Apr 22, 2024
5628306
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy Apr 23, 2024
92741a9
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy Apr 30, 2024
afbee76
Merge branch 'main' into add-tagify-scss-customization
IsaiahLevy May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,21 @@ export function attributesIcons() {
export function css() {
console.log("(re)building css");

return src(sassSrc).
pipe(init()).
pipe(
return src(sassSrc)
.pipe(init())
.pipe(
sass({
errLogToConsole: true,
outputStyle: "expanded",
includePaths: ["./node_modules/foundation-sites/scss"],
}).on("error", sass.logError)
).
pipe(minifyCSS()).
pipe(write(".")).
pipe(dest("./html/css/dist"));
)
.pipe(minifyCSS())
.pipe(write("."))
.pipe(dest("./html/css/dist"));
}


export function copyJs() {
return src([
"./node_modules/@webcomponents/**/webcomponentsjs/**/*.js",
Expand Down Expand Up @@ -133,16 +134,17 @@ function copyCss() {
"./node_modules/leaflet/dist/leaflet.css",
"./node_modules/leaflet.markercluster/dist/MarkerCluster.css",
"./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css",
"./node_modules/@yaireo/tagify/dist/tagify.css",
// "./node_modules/@yaireo/tagify/dist/tagify.css", // This line should be commented out or removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// "./node_modules/@yaireo/tagify/dist/tagify.css", // This line should be commented out or removed

"./node_modules/cropperjs/dist/cropper.css",
"./node_modules/select2/dist/css/select2.min.css",
]).
pipe(init()).
pipe(minifyCSS()).
pipe(write(".")).
pipe(dest("./html/css/dist"));
])
.pipe(init())
.pipe(minifyCSS())
.pipe(write("."))
.pipe(dest("./html/css/dist"));
}


function copyImages() {
return src(imagesSrc).pipe(dest("./html/css/dist"));
}
Expand Down
37 changes: 37 additions & 0 deletions lib/ProductOpener/APIProductServices.pm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks out of place

Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ my %service_functions = (
extend_ingredients => \&ProductOpener::Ingredients::extend_ingredients_service,
estimate_ingredients_percent => \&ProductOpener::Ingredients::estimate_ingredients_percent_service,
analyze_ingredients => \&ProductOpener::Ingredients::analyze_ingredients_service,
check_quality => \&check_quality_service,
);

sub check_product_services_api_input ($request_ref) {
Expand Down Expand Up @@ -231,4 +232,40 @@ sub product_services_api ($request_ref) {
return;
}


sub check_quality_service ($product_ref, $updated_product_fields_ref) {

# Call check_quality from DataQuality.pm
ProductOpener::DataQuality::check_quality($product_ref);

# Initialize arrays to store the structured quality issues
my $quality_issues = {
bugs => [],
info => [],
warnings => [],
errors => [],
};

# Extract and organize the quality tags
foreach my $type (qw(bugs info warnings errors)) {
my $tag_key = "data_quality_" . $type . "_tags";
if (defined $product_ref->{$tag_key} and @{$product_ref->{$tag_key}}) {
foreach my $tag (@{$product_ref->{$tag_key}}) {
push @{$quality_issues->{$type}}, $tag;
}
}
}

# Store the quality issues in the product_ref for returning to the client
$product_ref->{'data_quality_issues'} = $quality_issues;

# Indicate that we've updated the data_quality_issues field
$updated_product_fields_ref->{'data_quality_issues'} = 1;

return;
}




1;
2 changes: 2 additions & 0 deletions scss/app-ltr.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@import "variables";
@import "custom-tagify";
@import "variables";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"variable" is already imported in line 1. Does it have to be included here, again?

@import "settings";
@import "sveetoy/f5_settings";
@import "foundation";
Expand Down
2 changes: 2 additions & 0 deletions scss/app-rtl.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@import "variables";
@import "custom-tagify";
@import "variables";
@import "settings-rtl";
@import "sveetoy/f5_settings";
@import "foundation";
Expand Down
85 changes: 85 additions & 0 deletions scss/custom-tagify.scss
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IsaiahLevy your file has merging problems !

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<<<<<<< HEAD

@import "../node_modules/@yaireo/tagify/src/tagify.scss";
@import "variables";

// Global definitions for CSS custom properties
:root {
// Primary color for Tagify dropdown, set for easy theming
$tagify-dd-color-primary: #341100 !important;
--tagify-dd-color-primary: #341100 !important;
}

// Style adjustments for Tagify input placeholder
.tagify__input::placeholder {
color: $dark; // Use dark color for placeholder text as defined in variables
}

// Enhance hover state for Tagify tags for better user experience
.tagify__tag:hover {
background-color: var(--chocolate);
border-color: var(--chocolate-light);
}

// Default style for Tagify tag removal button
=======
@import "../node_modules/@yaireo/tagify/src/tagify.scss";
@import "variables";

// Placeholder style for Tagify input
.tagify__input::placeholder {
color: $dark;
}

// Hover state for Tagify tags
.tagify__tag:hover {
background-color: $chocolate; // Use 'chocolate' for better contrast and theme consistency
border-color: lighten($chocolate, 10%); // Lighten the chocolate color for border
}

// Style for the remove button in tags
>>>>>>> 336c50d8b87fe355cbdfc7d79595992b3fb9dc58
.tagify__tag .tagify__tag__removeBtn {
background-color: $text-color-dark;
}

<<<<<<< HEAD
// Hover effect for tag removal button, increases visibility and interactivity
.tagify__tag .tagify__tag__removeBtn:hover {
background-color: var(--chocolate);
}

// Base styling for dropdown items, setting defaults for readability and aesthetics
.tagify__dropdown__item {
background-color: white;
border-color: var(--chocolate-lighter);
color: black;
}

// Hover state for dropdown items to indicate selection possibility
.tagify__dropdown__item:hover {
background-color: var(--chocolate);
color: white;
}

// Active state styling for dropdown items to indicate current selection
.tagify__dropdown__item--active {
background-color: var(--chocolate);
color: white;
=======
// Hover state for the remove button in tags
.tagify__tag .tagify__tag__removeBtn:hover {
background-color: $chocolate; // Same 'chocolate' color for consistency
}

// Hover state for dropdown items
.tagify__dropdown__item--active,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this rule does not seems to work, but I don't know why.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thank you for the feedback. Just pushed changes to fix this.

.tagify__dropdown__item:hover {
background-color: $chocolate; // Again, using 'chocolate' for hover state
}

// Style for dropdown items
.tagify__dropdown__item {
border-color: lighten($chocolate, 20%); // Lighten for subtle borders
>>>>>>> 336c50d8b87fe355cbdfc7d79595992b3fb9dc58
}
1 change: 1 addition & 0 deletions templates/web/common/site_layout.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<link rel="stylesheet" href="[% static_subdomain %]/css/dist/app-[% edq(lang('text_direction')) %].css?v=[% css_timestamp %]" data-base-layout="true">
<link rel="stylesheet" href="[% static_subdomain %]/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="[% static_subdomain %]/css/dist/select2.min.css">
<link rel="stylesheet" href="[% static_subdomain %]/css/dist/custom-tagify.css" data-base-layout="true">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only really need Tagify in

<link rel="stylesheet" type="text/css" href="/css/dist/tagify.css" />
, so this probably needs to be removed, and the import in cgi/product_multilingual.pl should be updated.

<link rel="search" href="[% formatted_subdomain %]/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="[% edq(lang('site_name')) %]">
[% header %]
<style media="all">
Expand Down