Skip to content

Commit a0fbaed

Browse files
authored
refactor: show support link only for senseboxes, rename column to device (#859)
1 parent a4b9aac commit a0fbaed

4 files changed

Lines changed: 18 additions & 26 deletions

File tree

app/components/header/menu/index.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,6 @@ export default function Menu() {
129129
</DropdownMenuGroup>
130130
)}
131131
<DropdownMenuGroup>
132-
<Link to="https://docs.sensebox.de/" target="_blank">
133-
<DropdownMenuItem className="cursor-pointer">
134-
<Puzzle className="mr-2 h-5 w-5" />
135-
<span>{t('tutorials_label')}</span>
136-
<ExternalLink className="ml-auto h-4 w-4 text-gray-300" />
137-
</DropdownMenuItem>
138-
</Link>
139-
140132
<Link to="https://docs.opensensemap.org/" target="_blank">
141133
<DropdownMenuItem className="cursor-pointer">
142134
<Globe className="mr-2 h-5 w-5" />
@@ -155,12 +147,7 @@ export default function Menu() {
155147
</Link>
156148
</DropdownMenuGroup>
157149
<DropdownMenuGroup>
158-
<Link
159-
to={
160-
'/terms'
161-
}
162-
target="_blank"
163-
>
150+
<Link to={'/terms'} target="_blank">
164151
<DropdownMenuItem
165152
onSelect={(e) => e.preventDefault()}
166153
className="cursor-pointer"

app/components/mydevices/dt/columns.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type SenseBox = {
2626
exposure: Device['exposure']
2727
createdAt: Date
2828
archivedAt: Date | null
29+
model: Device['model']
2930
// model: string;
3031
}
3132

@@ -129,7 +130,7 @@ export function getColumns(
129130
{
130131
accessorKey: 'id',
131132
header: () => (
132-
<div className="pl-0 dark:text-white">{t('sensebox_id')}</div>
133+
<div className="pl-0 dark:text-white">{t('device_id')}</div>
133134
),
134135
cell: ({ row }) => {
135136
const device = row.original
@@ -195,15 +196,19 @@ export function getColumns(
195196
</a>
196197
)}
197198
</DropdownMenuItem>
198-
<DropdownMenuItem disabled={isArchived} asChild>
199-
<a
200-
href="https://sensebox.de/de/go-home"
201-
target="_blank"
202-
rel="noopener noreferrer"
203-
>
204-
{t('support')}
205-
</a>
206-
</DropdownMenuItem>
199+
{((device.model?.toLowerCase() ?? '').indexOf('sensebox') >=
200+
0 ||
201+
(device.model?.toLowerCase() ?? '').indexOf('home') >= 0) && (
202+
<DropdownMenuItem disabled={isArchived} asChild>
203+
<a
204+
href="https://sensebox.de/de/go-home"
205+
target="_blank"
206+
rel="noopener noreferrer"
207+
>
208+
{t('support')}
209+
</a>
210+
</DropdownMenuItem>
211+
)}
207212
<DropdownMenuItem
208213
asChild
209214
onClick={() => navigator.clipboard.writeText(device.id)}

public/locales/de/data-table.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"next_page": "Nächste Seite",
1010
"last_page": "Letzte Seite",
1111

12-
"sensebox_id": "Sensebox ID",
12+
"device_id": "Device ID",
1313
"actions": "Aktionen",
1414
"name": "Name",
1515
"createdAt": "Erstellt am",

public/locales/en/data-table.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"next_page": "Next page",
1010
"last_page": "Last page",
1111

12-
"sensebox_id": "Sensebox ID",
12+
"device_id": "Device ID",
1313
"actions": "Actions",
1414
"name": "Name",
1515
"createdAt": "Created at",

0 commit comments

Comments
 (0)