Skip to content

Commit

Permalink
Updated to v2.6.0-stable.20240112
Browse files Browse the repository at this point in the history
- Added a CODE_OF_CONDUCT file to the repository.
- Fixed a bug in english translation file.
- Fixed a bug where buttons and dropdowns doesn't have enough contrast to read text in them when a background image is displayed.
- ListeningActivityBarGraph now shows ListeningActivityBars according the available width.
  • Loading branch information
Sandakan committed Jan 12, 2024
1 parent 1af8ce3 commit 390827c
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 100 deletions.
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team. All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and appropriate
to the circumstances. The project team is obligated to maintain confidentiality
with regard to the reporter of an incident.Further details of specific enforcement
policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
2 changes: 1 addition & 1 deletion assets/locales/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@

"unsupportedFileMessagePrompt": {
"title": "Unsupported audio file",
"description": "You are trying to open a file with an<span/> extension, which is not supported by this app.<br/> Currently, we only support following audio formats. <div/>"
"description": "You are trying to open a file with a <span/> extension, which is not supported by this app.<br/> Currently, we only support following audio formats. <div/>"
},

"duplicateArtistsSuggestion": {
Expand Down
2 changes: 1 addition & 1 deletion src/main/core/fetchSongInfoFromLastFM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const fetchSongInfoFromLastFM = async (
const res = await fetch(url);
if (res.ok) {
const data = (await res.json()) as LastFMTrackInfoApi;
if (data.error) {
if ('error' in data) {
log(
`====== ERROR OCCURRED FETCHING DATA FROM LAST_FM API ABOUT SONG INFORMATION. ======\nERROR : ${data.error} => ${data.message}`,
);
Expand Down
21 changes: 18 additions & 3 deletions src/main/core/getSongLyrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,23 @@ const saveLyricsAutomaticallyIfAsked = async (
return undefined;
};

const fetchOfflineLyrics = async (songPath: string) => {
const audioSourceLyrics = fetchLyricsFromAudioSource(songPath);

if (audioSourceLyrics) {
log('Serving audio source lyrics.');
return audioSourceLyrics;
}

const lrcFileLyrics = await fetchLyricsFromLRCFile(songPath);
if (lrcFileLyrics) {
log('Serving lrc file lyrics.');
return lrcFileLyrics;
}

return undefined;
};

const getSongLyrics = async (
trackInfo: LyricsRequestTrackInfo,
lyricsType: LyricsTypes = 'ANY',
Expand All @@ -235,9 +252,7 @@ const getSongLyrics = async (

log(`Fetching lyrics for '${songTitle} - ${songArtists.join(',')}'.`);

const offlineLyrics =
fetchLyricsFromAudioSource(songPath) ||
(await fetchLyricsFromLRCFile(songPath));
const offlineLyrics = await fetchOfflineLyrics(songPath);

if (offlineLyrics) isOfflineLyricsAvailable = true;

Expand Down
2 changes: 1 addition & 1 deletion src/main/fs/addWatchersToFolders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const checkForFolderUpdates = async (folder: FolderStructure) => {

const folderWatcherFunction = async (
eventType: WatchEventType,
filename: string,
filename: string | null | undefined,
folder: MusicFolderData,
abortSignal: AbortSignal,
) => {
Expand Down
4 changes: 2 additions & 2 deletions src/main/fs/addWatchersToParentFolders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fileNameRegex = /^.{1,}\.\w{1,}$/;

const parentFolderWatcherFunction = async (
eventType: WatchEventType,
filename: string,
filename?: string | null,
) => {
if (filename) {
if (eventType === 'rename') {
Expand All @@ -24,7 +24,7 @@ const parentFolderWatcherFunction = async (
}
} else {
log(
'ERROR OCCURRED WHEN TRYING TO WATCH PARENT FOLDERS. FILE WATCHER FUNCTION SENT A FILENAME OF undefined.',
'ERROR OCCURRED WHEN TRYING TO WATCH PARENT FOLDERS. FILE WATCHER FUNCTION SENT A FILENAME OF undefined or null.',
undefined,
'ERROR',
);
Expand Down
32 changes: 15 additions & 17 deletions src/renderer/components/ArtistInfoPage/ArtistInfoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -663,27 +663,24 @@ const ArtistInfoPage = () => {
: 'text-font-color-black dark:text-font-color-white'
} mb-4 mt-1 pr-4 text-2xl`}
otherItems={[
isMultipleSelectionEnabled &&
multipleSelectionsData.selectionType === 'songs' ? (
<p className="text-sm text-font-color-highlight dark:text-dark-font-color-highlight">
{t('common.selectionWithCount', {
count: multipleSelectionsData.multipleSelections.length,
})}
</p>
) : (
<p className="text-xs text-font-color-highlight dark:text-dark-font-color-highlight">
{t('common.songWithCount', { count: songs.length })}
{songs.length > 5 && !isAllSongsVisible && (
<> ({t('common.shownWithCount', { count: 5 })})</>
)}
</p>
),
<p className="text-sm text-font-color-highlight dark:text-dark-font-color-highlight">
{isMultipleSelectionEnabled &&
multipleSelectionsData.selectionType === 'songs'
? t('common.selectionWithCount', {
count: multipleSelectionsData.multipleSelections.length,
})
: `${t('common.songWithCount', { count: songs.length })} ${
songs.length > 5 &&
!isAllSongsVisible &&
t('common.shownWithCount', { count: 5 })
}`}
</p>,
]}
buttons={[
{
tooltipLabel: t('common.moreOptions'),
className:
'more-options-btn text-sm md:text-lg md:[&>.button-label-text]:hidden md:[&>.icon]:mr-0',
'more-options-btn text-sm md:text-lg md:[&>.button-label-text]:hidden md:[&>.icon]:mr-0 !bg-background-color-1/40 dark:!bg-dark-background-color-1/40',
iconName: 'more_horiz',
clickHandler: (e) => {
e.stopPropagation();
Expand Down Expand Up @@ -746,7 +743,8 @@ const ArtistInfoPage = () => {
{
label: t('common.showAll'),
iconName: 'apps',
className: 'show-all-btn text-sm font-normal',
className:
'show-all-btn text-sm font-normal !bg-background-color-1/40 dark:!bg-dark-background-color-1/40',
clickHandler: () => setIsAllSongsVisible(true),
isVisible: songs.length > 5 && !isAllSongsVisible,
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Dropdown<T extends string>(props: DropdownProp<T>) {
<select
name={name}
id={name}
className={`dropdown h-10 w-60 cursor-pointer appearance-none rounded-lg border-[3px] border-background-color-2 bg-[transparent] px-3 text-sm text-font-color-black outline-none backdrop-blur-sm transition-[border-color] ease-in-out hover:border-background-color-3 focus:!border-background-color-3 focus-visible:!border-font-color-highlight-2 active:border-background-color-3 dark:border-dark-background-color-2 dark:bg-[transparent] dark:text-font-color-white dark:hover:border-dark-background-color-3 dark:focus:!border-dark-background-color-3 dark:focus-visible:!border-dark-font-color-highlight-2 dark:active:border-dark-background-color-3 ${
className={`dropdown h-10 w-60 cursor-pointer appearance-none rounded-lg border-[3px] border-background-color-2 bg-background-color-1/40 px-3 text-sm text-font-color-black outline-none backdrop-blur-sm transition-[border-color] ease-in-out hover:border-background-color-3 focus:!border-background-color-3 focus-visible:!border-font-color-highlight-2 active:border-background-color-3 dark:border-dark-background-color-2 dark:bg-dark-background-color-1/40 dark:text-font-color-white dark:hover:border-dark-background-color-3 dark:focus:!border-dark-background-color-3 dark:focus-visible:!border-dark-font-color-highlight-2 dark:active:border-dark-background-color-3 ${
isDisabled &&
`!cursor-not-allowed !border-font-color-dimmed/10 !text-opacity-50 !opacity-50 !brightness-90 !backdrop-blur-none !transition-none dark:!border-font-color-dimmed/40`
} ${className}`}
Expand Down
40 changes: 40 additions & 0 deletions src/renderer/components/SongInfoPage/ListeningActivityBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useTranslation } from 'react-i18next';

type Props = {
monthName: string;
noOfListens: number;
maxNoOfListens: number;
index: number;
};

const ListeningActivityBar = (props: Props) => {
const { monthName, noOfListens, maxNoOfListens, index } = props;
const { t } = useTranslation();

return (
<div className="relative flex h-full flex-col items-center justify-end">
<div className="flex h-full items-end rounded-2xl bg-background-color-1/25 dark:bg-dark-background-color-1/25">
<div
className="order-1 w-[10px] rounded-2xl bg-font-color-highlight transition-[height] delay-200 duration-300 ease-in-out dark:bg-dark-font-color-highlight"
style={{
height: `${
noOfListens === 0
? '10px'
: `${(noOfListens / maxNoOfListens) * 90}%`
}`,
transitionDelay: `${index * 50 + 500}`,
}}
title={t('songInfoPage.listensCount', {
count: noOfListens,
})}
/>
</div>
<div className="order-2 flex w-full grow-0 flex-col pt-1 text-font-color dark:text-font-color-white">
<span className="font-thin">{noOfListens}</span>
<span className="truncate px-2">{monthName}</span>
</div>
</div>
);
};

export default ListeningActivityBar;
Loading

0 comments on commit 390827c

Please sign in to comment.