Skip to content

Commit

Permalink
Changed hashing library to fix: BUG Sort out the colour updates for t…
Browse files Browse the repository at this point in the history
…he measurement station lines #257
  • Loading branch information
Ben-EJ committed Aug 2, 2024
1 parent 6870c64 commit d59112a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions air-quality-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions air-quality-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"echarts": "^5.5.0",
"echarts-for-react": "^3.0.2",
"jest-each": "^29.7.0",
"js-sha1": "^0.7.0",
"luxon": "^3.4.4",
"maplibre-gl": "^4.5.0",
"prettier": "^3.3.2",
Expand Down
3 changes: 2 additions & 1 deletion air-quality-ui/src/services/echarts-service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sha1 } from 'js-sha1'
import { DateTime } from 'luxon'

/**
Expand Down Expand Up @@ -38,7 +39,7 @@ export const textToColor = async (text: string): Promise<string> => {
const generateHash = async (text: string): Promise<ArrayBuffer> => {
const encoder = new TextEncoder()
const data = encoder.encode(text)
return await crypto.subtle.digest('SHA-256', data)
return await sha1.arrayBuffer(data)
}

// Convert the hash to a hexadecimal string
Expand Down

0 comments on commit d59112a

Please sign in to comment.