Skip to content

fix: Add Weekdays, Correct Font Color #4836

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

Merged
merged 6 commits into from
Aug 22, 2020
Merged

fix: Add Weekdays, Correct Font Color #4836

merged 6 commits into from
Aug 22, 2020

Conversation

maze-runnar
Copy link
Contributor

Fixes #4812

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Aug 21, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/pgjyqw4wo
✅ Preview: https://open-event-frontend-git-fork-maze-runnar-patch-1.eventyay.vercel.app

</strong>
{{/if}}
</p>
<a href="{{href-to 'public.sessions.list' 'all'}}#session-id-{{session.id}}">
<div class="ui fluid padded" style={{css color=session.track.fontColor background-color=session.track.color}}>
<h3 class="item" style={{css user-select='text'}}>
<h3 class="item" style={{css user-select='text' color='white'}}>
Copy link
Member

Choose a reason for hiding this comment

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

Should be dynamic with the help of isLight

Create a helper for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -48,13 +48,13 @@
<p>
{{#if session.startsAt}}
<strong>
{{moment-format session.startsAt 'DD MMM YY'}}
Copy link
Member

Choose a reason for hiding this comment

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

Use general-date helper and pass event timezone to get correct info

@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #4836 into development will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #4836      +/-   ##
===============================================
- Coverage        23.48%   23.47%   -0.01%     
===============================================
  Files              481      482       +1     
  Lines             5085     5086       +1     
  Branches            16       16              
===============================================
  Hits              1194     1194              
- Misses            3887     3888       +1     
  Partials             4        4              
Impacted Files Coverage Δ
app/helpers/is-light.js 0.00% <0.00%> (ø)
app/utils/color.ts 80.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a685be...16ff6bd. Read the comment docs.

@maze-runnar
Copy link
Contributor Author

Screenshot from 2020-08-21 19-08-32

default:
return 'white';
}
}
Copy link
Member

Choose a reason for hiding this comment

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

How does this help? It should take the background color as an argument and use the isLight utility function to decide the output color

Copy link
Contributor Author

@maze-runnar maze-runnar Aug 21, 2020

Choose a reason for hiding this comment

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

it is taking background color as params, if background color is non-white then it returns white as text-color, otherwise black

Copy link
Member

Choose a reason for hiding this comment

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

No, if the color string is exactly white, you return black, otherwise white. color will never be white, it's a hex string. Use isLight utility function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I am doing wrong in this helper , it is not working -


import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';

export function fonts(hex) {
  let x = isLight(hex,128);
  if(x){
    return 'black';
  }
  return 'white';
}
export default Helper.helper(fonts);

@@ -48,13 +48,13 @@
<p>
{{#if session.startsAt}}
<strong>
{{moment-format session.startsAt 'DD MMM YY'}}
{{general-date session.startsAt}}
Copy link
Member

Choose a reason for hiding this comment

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

You're neither passing event timezone nor the format

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is showing time correctly, that's why I think no need to pass format

Copy link
Member

Choose a reason for hiding this comment

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

Change the event timezone, then see what happens

@mariobehling
Copy link
Member

You added the feature to the speakers page, but it should be on a "tracks" page. The tracks should be on a dedicated (new) tracks page, that is a kind of a subpage to the schedule. So, you need to publish a schedule first.

The idea is, that the tracks page can be accessed through an indented menu item which should show up below the schedule menu item.

Please

  • Create a new dedicated "tracks" page for the feature
  • Add an indented menu item "Tracks" below the "Schedule" menu item

Screenshot from 2020-08-21 16-08-41

@iamareebjamal
Copy link
Member

@mariobehling The issue #4812 is about speaker page only

@maze-runnar
Copy link
Contributor Author

maze-runnar commented Aug 21, 2020

@iamareebjamal why this helper is not working -

import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';

export function textColur(color) {
  textColor = isLight(color) ? '#000' : '#fff'
  return textColor;
}
export default Helper.helper(textColur);

@iamareebjamal
Copy link
Member

Because you have written textColur as the helper name?

@iamareebjamal
Copy link
Member

This should be it

import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';

export function textColor(color) {
  return isLight(color) ? '#000' : '#fff';
}
export default Helper.helper(textColor);

@maze-runnar
Copy link
Contributor Author

This should be it

import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';

export function textColor(color) {
  return isLight(color) ? '#000' : '#fff';
}
export default Helper.helper(textColor);

After adding isLight util things are to working. I tested my helper, as soon as I removed isLight problem gone.

@iamareebjamal
Copy link
Member

Well, see the console why is it failing

@maze-runnar
Copy link
Contributor Author

@iamareebjamal now it's working, there was a prob in util fun itself.
Screenshot from 2020-08-21 23-21-11

@maze-runnar
Copy link
Contributor Author

timezone is fixed now -
Screenshot from 2020-08-21 23-48-44

Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- app/helpers/is-light.js  2
         

See the complete overview on Codacy

</strong>
{{/if}}
</p>
<a href="{{href-to 'public.sessions.list' 'all'}}#session-id-{{session.id}}">
<div class="ui fluid padded" style={{css color=session.track.fontColor background-color=session.track.color}}>
<h3 class="item" style={{css user-select='text'}}>
<h3 class="item" style={{css user-select='text' color=(is-light session.track.color)}}>
Copy link
Member

Choose a reason for hiding this comment

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

Helper name is textColor and here it is written is-light

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For general-date helper name in file is generalDate but we use general-date, the name of file.

@iamareebjamal iamareebjamal changed the title fix: Add Weekdays, Correct Font Color fix: Add Weekdays, Correct Font Color Aug 22, 2020
@iamareebjamal iamareebjamal merged commit 1d68722 into fossasia:development Aug 22, 2020
@maze-runnar maze-runnar deleted the patch-1 branch August 22, 2020 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Public Speakers Page/Scheduler Links, Add Weekdays, Add links to Scheduler Section, Correct Font Color
4 participants