public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Muhammad Rizki <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
	Arthur Lapz <[email protected]>, Memet Zx <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: Re: [PATCH v1 11/11] feat(page): implement chat bubble message rendering
Date: Sat, 23 Sep 2023 10:15:53 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 2023/09/23 午前3:58, Muhammad Rizki wrote:
> +      function getFixedRandomColor(name) {
> +        const textColors = [
> +          "text-red-400",      "text-yellow-400",
> +          "text-blue-400",     "text-sky-400",
> +          "text-purple-400",   "text-orange-400",
> +          "text-amber-400",    "text-lime-400",
> +          "text-green-400",    "text-emerald-400",
> +          "text-teal-400",     "text-cyan-400",
> +          "text-indigo-400",   "text-violet-400",
> +          "text-fuchsia-400",  "text-pink-400",
> +          "text-rose-400"
> +        ];
> +        const borderColors = [
> +          "border-red-400",      "border-yellow-400",
> +          "border-blue-400",     "border-sky-400",
> +          "border-purple-400",   "border-orange-400",
> +          "border-amber-400",    "border-lime-400",
> +          "border-green-400",    "border-emerald-400",
> +          "border-teal-400",     "border-cyan-400",
> +          "border-indigo-400",   "border-violet-400",
> +          "border-fuchsia-400",  "border-pink-400",
> +          "border-rose-400"
> +        ];
> +
> +        const hash = hashCode(name);
> +        const range = textColors && textColors.length;
At a glance, I thought that @range was a boolean. But it's not.
What does the "&&" operator do? Can't you just assign it this way?
```
     const range = textColors.length;
```
@textColors is always defined. I don't think it needs that
stupid "&&" op game either. What's the purpose behind it?

> +        const indexColor = hash % range;
> +
> +        return [
> +          textColors[(hashCode(name)) % range],
> +          borderColors[(hashCode(name)) % range]
> +        ];
> +      }

-- 
Ammar Faizi


  reply	other threads:[~2023-09-23  3:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 20:58 [PATCH v1 00/11] Refactoring and Add New Features Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 01/11] style: remove extra newline at end of file Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 02/11] feat(static/img): add `profile-cover.jpg` Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 03/11] refactor(page): improve page design and add profile image cover Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 04/11] feat(page): improve UX for copying text Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 05/11] chore(page): add newlines to enhance Developer Experience Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 06/11] feat(page): add GNUWeeb member list UI Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 07/11] feat(page): add `getOrgMembers()` function Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 08/11] feat(page): add `renderMemberList()` function Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 09/11] feat(page): add initial UI for displaying recent group messages Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 10/11] feat(css): add initial CSS class styles for chat bubbles Muhammad Rizki
2023-09-22 20:58 ` [PATCH v1 11/11] feat(page): implement chat bubble message rendering Muhammad Rizki
2023-09-23  3:15   ` Ammar Faizi [this message]
2023-09-23  8:43     ` Muhammad Rizki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox