Skip to content

Commit

Permalink
feat: Show warning or blocked status
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia committed Oct 3, 2023
1 parent 714e591 commit 24a06e6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@
color: #cfcdd4;
}

.WorldListPage .TableRow .world-status.warning {
color: var(--danger);
}

.WorldListPage .TableRow .world-status.blocked {
color: var(--error);
}

.WorldListPage .ui.pagination {
width: 100%;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { config } from 'config'
import { isDevelopment } from 'lib/environment'
import { WorldsWalletStats } from 'lib/api/worlds'
import { ENS } from 'modules/ens/types'
import { isExternalName } from 'modules/ens/utils'
import { locations } from 'routing/locations'
import CopyToClipboard from 'components/CopyToClipboard/CopyToClipboard'
import Icon from 'components/Icon'
Expand Down Expand Up @@ -124,7 +125,21 @@ const WorldListPage: React.FC<Props> = props => {
}

const renderWorldStatus = (ens: ENS) => {
const status = isWorldDeployed(ens) ? 'active' : 'inactive'
let status = isWorldDeployed(ens) ? 'active' : 'inactive'

if (status === 'active' && worldsWalletStats && !isExternalName(ens.subdomain)) {
const blockedSince = new Date(worldsWalletStats.blockedSince).getTime()
const now = new Date().getTime()

if (now >= blockedSince) {
if (now - blockedSince > 48 * 60 * 60 * 1000 /* 48 hours */) {
status = 'blocked'
} else {
status = 'warning'
}
}
}

return <span className={`world-status ${status}`}>{t(`worlds_list_page.table.status_${status}`)}</span>
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/api/worlds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type WorldsWalletStats = {
}[]
usedSpace: string
maxAllowedSpace: string
blockedSince: string
}

export class WorldsAPI extends BaseAPI {
Expand Down
2 changes: 2 additions & 0 deletions src/modules/translation/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,8 @@
"status": "Status",
"status_active": "Active",
"status_inactive": "Inactive",
"status_warning": "Warning",
"status_blocked": "Blocked",
"actions": "Actions",
"empty_url": "To activate this world you need to publish a scene",
"size": "Size mb"
Expand Down
2 changes: 2 additions & 0 deletions src/modules/translation/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@
"status": "Estado",
"status_active": "Activo",
"status_inactive": "Inactivo",
"status_warning": "Atención",
"status_blocked": "Bloqueado",
"actions": "Acciones",
"empty_url": "Para activar este mundo, necesitas publicar una escena",
"size": "Peso mb"
Expand Down
2 changes: 2 additions & 0 deletions src/modules/translation/languages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@
"status": "地位",
"status_active": "积极的",
"status_inactive": "不活动",
"status_warning": "注意力",
"status_blocked": "锁定",
"actions": "动作",
"empty_url": "要激活这个世界,您需要发布一个场景",
"size": "大小 兆字节"
Expand Down

0 comments on commit 24a06e6

Please sign in to comment.