Compare commits

...

1 Commits

Author SHA1 Message Date
05a04ec922 Add PIS Data formatting to TrainService expander 2026-05-05 19:24:31 +01:00
3 changed files with 85 additions and 49 deletions

View File

@@ -33,7 +33,7 @@
if (onsubmit && value) { if (onsubmit && value) {
onsubmit(value); onsubmit(value);
} }
} };
</script> </script>
<div class="input-wrapper" class:focussed={isFocussed} class:has-error={!!error}> <div class="input-wrapper" class:focussed={isFocussed} class:has-error={!!error}>
@@ -42,28 +42,28 @@
{/if} {/if}
<form onsubmit={handleSubmit} class="input-container"> <form onsubmit={handleSubmit} class="input-container">
<input <input
id="adaptive-input" id="adaptive-input"
class:all-caps={uppercase} class:all-caps={uppercase}
{type} {type}
{placeholder} {placeholder}
bind:value bind:value
onfocus={() => (isFocussed = true)} onfocus={() => (isFocussed = true)}
onblur={() => (isFocussed = false)} onblur={() => (isFocussed = false)}
{...rest} {...rest}
/> />
{#if onsubmit} {#if onsubmit}
<button <button
type="submit" type="submit"
class="submit-icon" class="submit-icon"
transition:fade transition:fade
disabled={!value} disabled={!value}
aria-label="Submit" aria-label="Submit"
> >
<IconChevronRightFilled /> <IconChevronRightFilled />
</button> </button>
{/if} {/if}
</form> </form>
{#if error} {#if error}
@@ -125,18 +125,20 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
opacity: 0.75; opacity: 0.75;
transition: opacity 0.2s, transform 0.2s; transition:
opacity 0.2s,
transform 0.2s;
} }
.submit-icon:hover:not(:disabled) { .submit-icon:hover:not(:disabled) {
opacity: 1; opacity: 1;
transform: translateX(2px); transform: translateX(2px);
} }
.submit-icon:disabled { .submit-icon:disabled {
opacity: 0.5; opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
} }
.all-caps { .all-caps {
text-transform: uppercase; text-transform: uppercase;

View File

@@ -93,7 +93,7 @@
}; };
</script> </script>
<div class="train-service" class:isExpanded={isExpanded}> <div class="train-service" class:isExpanded>
<button class="summary" onclick={toggleExpand} type="button" aria-expanded={isExpanded}> <button class="summary" onclick={toggleExpand} type="button" aria-expanded={isExpanded}>
{#if loadingDetails} {#if loadingDetails}
<div class="loading-state"><div class="loading-spinner"></div></div> <div class="loading-state"><div class="loading-spinner"></div></div>
@@ -147,7 +147,15 @@
{/if} {/if}
{#if details.pis} {#if details.pis}
<div class="pis-detail"> <div class="pis-detail">
{details.pis.code} <span class="pis-code">PIS: {details.Pis.code}</span>
{#if details.Pis.skip?.skip > 0}
<span class="pis-skip">
(skip {details.Pis.skip.position === 'head' ? 'first' : 'last'}
{details.Pis.skip.skip}
{details.Pis.skip.skip === 1 ? 'stop' : 'stops'}
)
</span>
{/if}
</div> </div>
{/if} {/if}
</div> </div>
@@ -173,8 +181,7 @@
</tr> </tr>
</thead> </thead>
{#each details.locations as loc} {#each details.locations as loc}
<tbody class="location-group"> <tbody class="location-group">
<tr class:pass-loc={loc.r === 'PASS'} class:can-loc={loc.can}> <tr class:pass-loc={loc.r === 'PASS'} class:can-loc={loc.can}>
<td class="tpl-cell" class:tpl-stop={loc.r != 'PASS'}> <td class="tpl-cell" class:tpl-stop={loc.r != 'PASS'}>
{loc.t} {loc.t}
@@ -202,18 +209,17 @@
{/if} {/if}
</tr> </tr>
{#if loc.act && getRelevantActivities(loc.act).length > 0} {#if loc.act && getRelevantActivities(loc.act).length > 0}
<tr class="activity-row"> <tr class="activity-row">
<td colspan="7"> <td colspan="7">
<div class="activity-container"> <div class="activity-container">
{#each getRelevantActivities(loc.act) as note} {#each getRelevantActivities(loc.act) as note}
<span class="activity-tag">{note}</span> <span class="activity-tag">{note}</span>
{/each} {/each}
</div> </div>
</td> </td>
</tr> </tr>
{/if} {/if}
</tbody>{/each}
</tbody>{/each}
</table> </table>
</div> </div>
</div> </div>
@@ -318,6 +324,29 @@
color: red; color: red;
} }
/*
PIS Data
*/
.pis-detail {
display: flex;
align-items: center;
flex-direction: column;
gap: 0.2rem;
padding: 8px 0;
width: 100%;
}
.pis-code {
font-weight: 600;
font-size: 1.1rem;
letter-spacing: 0.05em;
}
.pis-skip {
font-size: 0.85rem;
opacity: 0.75;
font-style: oblique;
}
/* /*
Box Extention Box Extention
*/ */
@@ -416,9 +445,9 @@
.activity-tag { .activity-tag {
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.05);
padding: 2px 6px; padding: 2px 6px;
border-radius: 4px; border-radius: 4px;
} }
.tpl-cell { .tpl-cell {

View File

@@ -18,7 +18,12 @@
<BaseCard header={'Search Train & PIS'}> <BaseCard header={'Search Train & PIS'}>
<div class="card-content"> <div class="card-content">
<Textbox placeholder="Enter Headcode" bind:value={headcode} maxLength={4} onsubmit={handleSearch} /> <Textbox
placeholder="Enter Headcode"
bind:value={headcode}
maxLength={4}
onsubmit={handleSearch}
/>
</div> </div>
</BaseCard> </BaseCard>