Skip to content

Commit

Permalink
fix: add date to source card
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Aug 29, 2024
1 parent a5c9801 commit 22595f4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/components/inventory/EditViewContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IInput {
name: string;
location: string;
type: SourceType | '';
lastConnected: Date | '';
audioMapping?: Numbers[];
}

Expand All @@ -41,7 +42,10 @@ interface IContext {
}

export const EditViewContext = createContext<IContext>({
input: [{ name: '', location: '', type: '', audioMapping: [] }, () => null],
input: [
{ name: '', location: '', type: '', lastConnected: '', audioMapping: [] },
() => null
],
saved: [undefined, () => null],
loading: false,
isSame: true,
Expand All @@ -66,6 +70,7 @@ export default function Context({
name: source.name,
location: source.tags.location,
type: source.type,
lastConnected: source.lastConnected,
// audioMapping: source?.stream_settings?.audio_mapping || []
audioMapping: source?.audio_stream.audio_mapping || []
});
Expand All @@ -81,6 +86,7 @@ export default function Context({
name: source.name,
location: source.tags.location,
type: source.type,
lastConnected: source.lastConnected,
// audioMapping: source?.stream_settings?.audio_mapping || []
audioMapping: source?.audio_stream.audio_mapping || []
}));
Expand Down
9 changes: 9 additions & 0 deletions src/components/inventory/editView/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ export default function GeneralSettings() {
</div>
</div>

<div className="flex mb-5">
<h2 className="flex w-[100px] items-center">
{t('source.last_connected')}
</h2>
<div className="flex-col">
<p>{new Date(input.location).toLocaleString()}</p>
</div>
</div>

{height && width && (
<div className="flex mb-5">
<h2 className="flex w-[100px] items-center">{t('video')}</h2>
Expand Down
4 changes: 4 additions & 0 deletions src/components/sourceListItem/SourceListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ function InventoryListItem({
: capitalize(source.tags.location)
})}
</h2>
<h2 className="text-sm">
{t('source.last_connected')}:{' '}
{new Date(source.lastConnected).toLocaleString()}
</h2>
<h2 className="text-xs">
{t('source.ingest', {
ingest: source.ingest_name
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const en = {
audio: 'Audio: {{audio}}',
orig: 'Original Name: {{name}}',
metadata: 'Source Metadata',
location_unknown: 'Unknown'
location_unknown: 'Unknown',
last_connected: 'Last connection'
},
delete_source_status: {
delete_stream: 'Delete stream',
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const sv = {
audio: 'Ljud: {{audio}}',
orig: 'Enhetsnamn: {{name}}',
metadata: 'Käll-metadata',
location_unknown: 'Okänd'
location_unknown: 'Okänd',
last_connected: 'Senast uppkoppling'
},
delete_source_status: {
delete_stream: 'Radera ström',
Expand Down

0 comments on commit 22595f4

Please sign in to comment.