Skip to content

Commit

Permalink
Merge pull request Shelf-nu#646 from Shelf-nu/adding-time-to-notes
Browse files Browse the repository at this point in the history
updating how date/time is being displayed on notes & fixing some TS i…
  • Loading branch information
DonKoko authored Jan 8, 2024
2 parents c5d99ad + 5524299 commit c6501e8
Show file tree
Hide file tree
Showing 7 changed files with 3,139 additions and 1,324 deletions.
7 changes: 2 additions & 5 deletions app/components/assets/custom-fields-inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,8 @@ export default function AssetCustomFields({
defaultValue={val ? val : field.required ? field.options[0] : ""}
disabled={disabled}
>
<SelectTrigger
className="px-3.5 py-3"
placeholder={`Choose ${field.name}`}
>
<SelectValue />
<SelectTrigger className="px-3.5 py-3">
<SelectValue placeholder={`Choose ${field.name}`} />
</SelectTrigger>
<SelectContent
position="popper"
Expand Down
8 changes: 2 additions & 6 deletions app/components/custom-fields/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,8 @@ export const CustomFieldForm = ({
disabled={disabled}
onValueChange={(val: CustomFieldType) => setSelectedType(val)}
>
<SelectTrigger
disabled={isEdit}
className="px-3.5 py-3"
placeholder="Choose a field type"
>
<SelectValue />
<SelectTrigger disabled={isEdit} className="px-3.5 py-3">
<SelectValue placeholder="Choose a field type" />
</SelectTrigger>
<SelectContent
position="popper"
Expand Down
7 changes: 2 additions & 5 deletions app/components/workspace/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ export const WorkspaceForm = ({ name, currency }: Props) => {
disabled={disabled}
name={zo.fields.currency()}
>
<SelectTrigger
className="px-3.5 py-3"
placeholder="Choose a field type"
>
<SelectValue />
<SelectTrigger className="px-3.5 py-3">
<SelectValue placeholder="Choose a field type" />
</SelectTrigger>
<SelectContent
position="popper"
Expand Down
10 changes: 8 additions & 2 deletions app/routes/_layout+/assets.$assetId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,20 @@ export async function loader({ request, params }: LoaderFunctionArgs) {

const notes = asset.notes.map((note) => ({
...note,
dateDisplay: getDateTimeFormat(request).format(note.createdAt),
dateDisplay: getDateTimeFormat(request, {
dateStyle: "short",
timeStyle: "short",
}).format(note.createdAt),
content: parseMarkdownToReact(note.content),
}));

let custody = null;
if (asset.custody) {
const date = new Date(asset.custody.createdAt);
const dateDisplay = getDateTimeFormat(request).format(date);
const dateDisplay = getDateTimeFormat(request, {
dateStyle: "short",
timeStyle: "short",
}).format(date);

custody = {
...asset.custody,
Expand Down
7 changes: 2 additions & 5 deletions app/routes/_layout+/settings.general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,8 @@ export default function GeneralPage() {
disabled={disabled}
name={zo.fields.currency()}
>
<SelectTrigger
className="px-3.5 py-3"
placeholder="Choose a field type"
>
<SelectValue />
<SelectTrigger className="px-3.5 py-3">
<SelectValue placeholder="Choose a field type" />
</SelectTrigger>
<SelectContent
position="popper"
Expand Down
3 changes: 1 addition & 2 deletions app/utils/client-hints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export function getDateTimeFormat(
};

options = {
...defaultOptions,
...options,
...(options || defaultOptions),
timeZone: options?.timeZone ?? getHints(request).timeZone,
};
return new Intl.DateTimeFormat(locale, options);
Expand Down
Loading

0 comments on commit c6501e8

Please sign in to comment.