@worksafevictoria/wcl7.5 1.1.0-beta.84 → 1.1.0-beta.86

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worksafevictoria/wcl7.5",
3
- "version": "1.1.0-beta.84",
3
+ "version": "1.1.0-beta.86",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,11 +12,10 @@
12
12
  <b-carousel-slide
13
13
  v-for="item in filteredCarouselItems"
14
14
  :key="item.id"
15
-
16
- :img-src="item.image"
17
- @click.prevent="handleClick(item.link)"
15
+ :img-src="getImageURL(item.field_image.field_media_image?.uri?.url)"
16
+ @click.prevent="handleClick(item.field_link.url)"
18
17
  >
19
- <h4>{{ item.content}}</h4>
18
+ <h4>{{ item.field_title}}</h4>
20
19
  </b-carousel-slide>
21
20
  </b-carousel>
22
21
  </div>
@@ -54,10 +53,10 @@ export default {
54
53
  var todayDate = new Date()
55
54
 
56
55
  for (var i = 0, length = this.carouselItems.length; i < length; i++) {
57
- if (this.carouselItems[i].favorite === 'Yes') {
56
+ if (this.carouselItems[i].field_favorite === true) {
58
57
  this.carouselItems[i].active = 'Yes'
59
- } else if (new Date(this.carouselItems[i].dateStart).valueOf() <= todayDate.valueOf()) {
60
- if (new Date(this.carouselItems[i].dateEnd).valueOf() >= todayDate.valueOf()) {
58
+ } else if (new Date(this.carouselItems[i].field_date_start).valueOf() <= todayDate.valueOf()) {
59
+ if (new Date(this.carouselItems[i].field_date_end).valueOf() >= todayDate.valueOf()) {
61
60
  this.carouselItems[i].active = 'Yes'
62
61
  }
63
62
  }
@@ -84,6 +83,12 @@ export default {
84
83
  }
85
84
  },
86
85
 
86
+ getImageURL(imagePath) {
87
+ let apiPath = this.$config ? this.$config.public.apiURL : process.env.CONTENT_API_URL;
88
+ let fullPath = apiPath.concat(imagePath)
89
+ return fullPath
90
+ },
91
+
87
92
  formatDate(date) {
88
93
  return [
89
94
  date.getFullYear(),
@@ -103,6 +108,7 @@ export default {
103
108
  .carousel {
104
109
  position: relative;
105
110
  padding-bottom: 7rem;
111
+ max-width: 540px;
106
112
  }
107
113
 
108
114
  .carousel-inner {
@@ -1,5 +1,4 @@
1
1
  import { BaseFormElement } from '../base-form-element'
2
- import { Buffer } from 'buffer'
3
2
 
4
3
  export class FileFormElement extends BaseFormElement {
5
4
  getType() {
@@ -10,11 +9,17 @@ export class FileFormElement extends BaseFormElement {
10
9
  const promises = await Promise.all(
11
10
  value.map((file) => {
12
11
  const base64Data = file.url.split(',')[1]
13
- const buffer = Buffer.from(base64Data, 'base64')
12
+ //const buffer = Buffer.from(base64Data, 'base64')
13
+ const binaryData = atob(base64Data)
14
+ const byteArray = new Uint8Array(binaryData.length)
15
+ for (let i = 0; i < binaryData.length; i++) {
16
+ byteArray[i] = binaryData.charCodeAt(i)
17
+ }
18
+ const blob = new Blob([byteArray], { type: 'text/plain' })
14
19
 
15
20
  return axios.post(
16
21
  `https://content-dev-v2.api.worksafe.vic.gov.au/webform_rest/${this.webformElement['#webform']}/upload/file`,
17
- buffer,
22
+ blob,
18
23
  {
19
24
  headers: {
20
25
  'Content-Type': 'application/octet-stream',
package/src/index.js CHANGED
@@ -5,6 +5,7 @@ import Column from './components/Containers/Column/index.vue'
5
5
  import HomepageHeader from './components/Containers/HomepageHeader/index.vue'
6
6
  import Subheader from './components/Containers/Subheader/index.vue'
7
7
  import SectionGroup from './components/Containers/SectionGroup/index.vue'
8
+ import CarouselComponent from './components/Containers/Carousel/index.vue'
8
9
 
9
10
  import AppHeader from './components/Global/AppHeader/index.vue'
10
11
  import AppFooter from './components/Global/AppFooter/index.vue'
@@ -78,7 +79,8 @@ export {
78
79
  Cookies,
79
80
  BackToTop,
80
81
  GlobalNotice,
81
- ContrastMode
82
+ ContrastMode,
83
+ CarouselComponent
82
84
  }
83
85
 
84
86
  // Export Paragraphs
@@ -1,57 +1,82 @@
1
1
  export const mockCarouselItems = [
2
2
  {
3
- content: 'This is the first slider',
4
- image:
5
- 'https://picsum.photos/1024/480/?image=52',
6
- link: 'www.google.com',
7
- dateStart: '2024-01-12T09:45:00+11:00',
8
- dateEnd: '2024-02-12T09:45:00+11:00',
9
- favorite: 'Yes'
3
+ field_title: 'This is the first slider',
4
+ field_image: {
5
+ field_media_image: {
6
+ uri: {
7
+ url: '/sites/default/files/2025-01/image-ag-safety-network-veg-001.jpg'
8
+ }
9
+ }
10
+ },
11
+ field_link: {
12
+ url: 'https://www.google.com',
13
+ },
14
+ field_date_start: '2025-02-05',
15
+ field_date_end: '2025-03-07',
16
+ field_favorite: true
10
17
  },
11
18
  {
12
- content: 'This is the second slider',
13
- image:
14
- 'https://picsum.photos/1024/480/?image=54',
15
- link: '/asbestos-removal-notification',
16
- dateStart: '2025-12-01T09:45:00+11:00',
17
- dateEnd: '2025-12-12T09:45:00+11:00',
18
- favorite: ''
19
+ field_title: 'This is the second slider',
20
+ field_image: {
21
+ field_media_image: {
22
+ uri: {
23
+ url: '/sites/default/files/2025-01/large-2023%20WorkSafe%20Awards.jpg'
24
+ }
25
+ }
26
+ },
27
+ field_link: {
28
+ url: '/news/2019-11/winners-named-distinguished-worksafe-awards',
29
+ },
30
+ field_date_start: '2025-02-05',
31
+ field_date_end: '2025-07-05',
32
+ field_favorite: false
19
33
  },
20
34
  {
21
- content: 'This is the third slider',
22
- image:
23
- 'https://picsum.photos/1024/480/?image=56',
24
- link: '/dangerous-goods-licences',
25
- dateStart: '2024-01-12T09:45:00+11:00',
26
- dateEnd: '2024-12-12T09:45:00+11:00',
27
- favorite: ''
35
+ field_title: 'This is the third slider',
36
+ field_image: {
37
+ field_media_image: {
38
+ uri: {
39
+ url: '/sites/default/files/2024-12/header-image-workwell-oelg-project.jpg'
40
+ }
41
+ }
42
+ },
43
+ field_link: {
44
+ url: '/resources/workwell-ageing-workforce-ready-age-difference',
45
+ },
46
+ field_date_start: '2024-01-12',
47
+ field_date_end: '2024-12-12',
48
+ favorite: false
28
49
  },
29
50
  {
30
- content: 'This is the fourth slider',
31
- image:
32
- 'https://picsum.photos/1024/480/?image=58',
33
- link: '/construction',
34
- dateStart: '2025-10-30T09:45:00+11:00',
35
- dateEnd: '2025-12-12T09:45:00+11:00',
36
- favorite: ''
51
+ field_title: 'This is the fourth slider',
52
+ field_image: {
53
+ field_media_image: {
54
+ uri: {
55
+ url: '/sites/default/files/styles/large/public/2018-06/Topics-explosives_0.jpg'
56
+ }
57
+ }
58
+ },
59
+ field_link: {
60
+ url: '/explosives',
61
+ },
62
+ field_date_start: '2025-01-30',
63
+ field_date_end: '2025-12-12',
64
+ field_favorite: false
37
65
  },
38
66
  {
39
- content: '',
40
- image:
41
- 'https://picsum.photos/1024/480/?image=60',
42
- link: '/construction',
43
- dateStart: '2024-10-30T09:45:00+11:00',
44
- dateEnd: '2025-12-12T09:45:00+11:00',
45
- favorite: ''
67
+ field_title: '',
68
+ field_image: {
69
+ field_media_image: {
70
+ uri: {
71
+ url: '/sites/default/files/styles/large/public/2022-07/card-bricklaying-3x2.jpg'
72
+ }
73
+ }
74
+ },
75
+ field_link: {
76
+ url: '/construction',
77
+ },
78
+ field_date_start: '2024-10-30',
79
+ field_date_end: '2025-12-12',
80
+ field_favorite: false
46
81
  },
47
- {
48
- content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla consectetur ligula ex',
49
- image:
50
- 'https://picsum.photos/1024/480/?image=62',
51
- link: '/construction',
52
- dateStart: '2024-10-30T09:45:00+11:00',
53
- dateEnd: '2025-11-12T09:45:00+11:00',
54
- favorite: ''
55
- },
56
- ]
57
-
82
+ ]