architwin 1.0.94 → 1.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,7 +48,9 @@ i18n
48
48
  "AddObject": "Add Object",
49
49
  "ConfirmDeleteTag": "Are you sure you want to delete this tag? This action cannot be reversed",
50
50
  "DeleteTag": "Delete Tag",
51
- "YesDelete": "Yes, delete"
51
+ "YesDelete": "Yes, delete",
52
+ "FileTooBig": "File too big! Please select a file with 2.5 MB and below.",
53
+ "RecipientError": "Select a recipient first"
52
54
  }
53
55
  },
54
56
  ja: {
@@ -78,7 +80,7 @@ i18n
78
80
  "EmbedMedia": "埋め込みメディア",
79
81
  "SaveTag": "タグ保存",
80
82
  "AddTag": "タグ追加",
81
- "NoRecipient": "未選択",
83
+ "NoRecipient": "宛先未選択",
82
84
  "You": "あなた",
83
85
  "MessageSentSuccess": "メッセージが登録されました",
84
86
  "ModelAddedToSpace": "スペースへの登録が完了しました",
@@ -91,7 +93,9 @@ i18n
91
93
  "AddObject": "追加",
92
94
  "ConfirmDeleteTag": "この操作は取り消すことができません。このタグを削除しますか?",
93
95
  "DeleteTag": "タグ削除",
94
- "YesDelete": "削除"
96
+ "YesDelete": "削除",
97
+ "FileTooBig": "ファイルが大きすぎます (2.5MBまで)",
98
+ "RecipientError": "宛先を選んでください"
95
99
  }
96
100
  }
97
101
  },
@@ -1,6 +1,6 @@
1
1
  import { getTagMessageRecepients, getTagMessages, getSelectedTagUuid, dispatchSpaceEvent, _tags } from "../../../architwin";
2
2
  import { SPACE_EVENTS } from "../../../types";
3
- import { convertToCssRgb, generateUUID } from "../../../utils";
3
+ import { bytesToMegabytes, convertToCssRgb, generateUUID } from "../../../utils";
4
4
  import { Notyf } from 'notyf';
5
5
  import 'notyf/notyf.min.css';
6
6
  import { parseISO } from 'date-fns';
@@ -60,7 +60,7 @@ export function renderRecepientOptions() {
60
60
  recepientDropdown.innerHTML = ``;
61
61
  const firstOp = document.createElement('option');
62
62
  firstOp.value = '';
63
- firstOp.textContent = 'No recepient';
63
+ firstOp.textContent = i18n.t('NoRecipient');
64
64
  recepientDropdown.appendChild(firstOp);
65
65
  recepients.forEach(recepient => {
66
66
  const optionElem = document.createElement('option');
@@ -224,10 +224,17 @@ export function createTagMessage() {
224
224
  const created_on = dateToString(currentDate);
225
225
  console.log("Recepient message ", recepient_uuid);
226
226
  if (!recepient_uuid || recepient_uuid.uuid === '' || recepient_uuid.uuid === 'undefined') {
227
- notyf.error("Select a recepient first");
227
+ notyf.error(i18n.t('RecipientError'));
228
228
  console.error("Please select a recepient first");
229
229
  return;
230
230
  }
231
+ const mediaSize = bytesToMegabytes(media.size);
232
+ console.log(`__@ media size: ${mediaSize.toFixed(2)} MB`);
233
+ if (mediaSize > 2.5) {
234
+ notyf.error(i18n.t('FileTooBig'));
235
+ console.error(`File too big: ${mediaSize.toFixed(2)} MB`);
236
+ return;
237
+ }
231
238
  if (!tag_uuid) {
232
239
  console.error("Tag uuid is undefined");
233
240
  return;
@@ -261,13 +268,14 @@ export function setTagMessagingDetails(tagId) {
261
268
  console.error("g does not exist in DOM");
262
269
  return;
263
270
  }
264
- if (tagTitle.textContent === i18n.t('TagName')) {
271
+ if (tagTitle.textContent === i18n.t('TagName') || tagTitle.textContent != '') {
265
272
  //@ts-ignore
266
273
  const targetTag = _tags.find(tag => tag.id === tagId);
267
274
  if (!targetTag) {
268
275
  console.log("Target tag not found");
269
276
  return;
270
277
  }
278
+ console.log("__@ targetTag: ", targetTag.json_data);
271
279
  tagTitle.textContent = targetTag.json_data.label;
272
280
  tagColor.style.backgroundColor = convertToCssRgb(targetTag.json_data.color);
273
281
  return;
package/lib/utils.d.ts CHANGED
@@ -27,3 +27,4 @@ export declare function dateTimeFormat(d: any): string;
27
27
  export declare function stringContains(str: string, target: string, isCaseSensitive?: boolean): boolean;
28
28
  export declare function getURLParams(param: string): string;
29
29
  export declare function useCapitalizeFirstLetter(string: string): string;
30
+ export declare function bytesToMegabytes(bytes: number): number;
package/lib/utils.js CHANGED
@@ -123,3 +123,6 @@ export function getURLParams(param) {
123
123
  export function useCapitalizeFirstLetter(string) {
124
124
  return string.charAt(0).toUpperCase() + string.slice(1);
125
125
  }
126
+ export function bytesToMegabytes(bytes) {
127
+ return bytes / (1024 * 1024);
128
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.0.94",
3
+ "version": "1.0.96",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",