Skip to content

Commit

Permalink
publish: Add Ubuntu 24.04 cozy-stack packages
Browse files Browse the repository at this point in the history
generated from commit b2d4b2f
  • Loading branch information
Travis CI User committed Sep 6, 2024
1 parent a7e5fa8 commit f95322b
Show file tree
Hide file tree
Showing 12 changed files with 528 additions and 470 deletions.
2 changes: 1 addition & 1 deletion en/cozy-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"cozy-sharing": "^15.0.0",
"cozy-stack-client": "^48.0.0",
"cozy-tsconfig": "1.2.0",
"cozy-ui": "^111.8.1",
"cozy-ui": "111.9.0",
"date-fns": "2.28.0",
"es-abstract": "1.20.2",
"form-data": "2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Announcements: FC = () => {

const moreThan = config?.delayAfterDismiss ?? 24
const hasBeenDismissedForMoreThan = values.dismissedAt
? differenceInHours(Date.parse(values.dismissedAt), new Date()) >= moreThan
? differenceInHours(new Date(), Date.parse(values.dismissedAt)) >= moreThan
: true
const canBeDisplayed = !hasBeenDismissed && hasBeenDismissedForMoreThan
const announcements = useAnnouncements({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { FC } from 'react'

import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import Typography from 'cozy-ui/transpiled/react/Typography'
import Buttons from 'cozy-ui/transpiled/react/Buttons'
import Markdown from 'cozy-ui/transpiled/react/Markdown'

import { Announcement } from './types'
import { useAnnouncementsImage } from 'hooks/useAnnouncementsImage'
Expand All @@ -21,7 +23,8 @@ const AnnouncementsDialogContent: FC<AnnouncementsDialogContentProps> = ({
}) => {
const { t, f } = useI18n()
const primaryImage = useAnnouncementsImage(
announcement.attributes.primary_image.data.attributes.formats.small.url
announcement.attributes.primary_image.data.attributes.formats.small?.url ??
announcement.attributes.primary_image.data.attributes.url
)
const secondaryImage = useAnnouncementsImage(
announcement.attributes.secondary_image.data?.attributes.formats.thumbnail
Expand Down Expand Up @@ -64,9 +67,9 @@ const AnnouncementsDialogContent: FC<AnnouncementsDialogContentProps> = ({
t('AnnouncementsDialogContent.dateFormat')
)}
</Typography>
<Typography align="center" className="u-mb-1">
{announcement.attributes.content}
</Typography>
<div className="u-ta-center u-maw-100">
<Markdown content={announcement.attributes.content} />
</div>
{announcement.attributes.main_action ? (
<Buttons
className="u-mb-half"
Expand Down
53 changes: 53 additions & 0 deletions en/cozy-home/src/components/Announcements/helpers.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { getUnseenAnnouncements } from './helpers'

describe('getUnseenAnnouncements', () => {
it('should return unseen announcements', () => {
const data = [
{ attributes: { uuid: '1', title: 'Announcement 1' } },
{ attributes: { uuid: '2', title: 'Announcement 2' } },
{ attributes: { uuid: '3', title: 'Announcement 3' } }
]
const announcements_seen = ['1', '3']
const expected = [{ attributes: { uuid: '2', title: 'Announcement 2' } }]

const result = getUnseenAnnouncements(data, announcements_seen)

expect(result).toEqual(expected)
})

it('should return all announcements if announcements_seen is empty', () => {
const data = [
{ attributes: { uuid: '1', title: 'Announcement 1' } },
{ attributes: { uuid: '2', title: 'Announcement 2' } },
{ attributes: { uuid: '3', title: 'Announcement 3' } }
]
const announcements_seen = []
const expected = [
{ attributes: { uuid: '1', title: 'Announcement 1' } },
{ attributes: { uuid: '2', title: 'Announcement 2' } },
{ attributes: { uuid: '3', title: 'Announcement 3' } }
]

const result = getUnseenAnnouncements(data, announcements_seen)

expect(result).toEqual(expected)
})

it('should return all announcements if announcements_seen is null', () => {
const data = [
{ attributes: { uuid: '1', title: 'Announcement 1' } },
{ attributes: { uuid: '2', title: 'Announcement 2' } },
{ attributes: { uuid: '3', title: 'Announcement 3' } }
]
const announcements_seen = null
const expected = [
{ attributes: { uuid: '1', title: 'Announcement 1' } },
{ attributes: { uuid: '2', title: 'Announcement 2' } },
{ attributes: { uuid: '3', title: 'Announcement 3' } }
]

const result = getUnseenAnnouncements(data, announcements_seen)

expect(result).toEqual(expected)
})
})
3 changes: 2 additions & 1 deletion en/cozy-home/src/components/Announcements/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ export interface Announcement {
data: {
attributes: {
formats: {
small: {
small?: {
url: string
}
}
alternativeText?: string
url: string
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions en/cozy-home/src/hooks/useAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const useAnnouncements = ({
const [fetchStatus, setFetchStatus] = useState('pending')
const [rawData, setRawData] = useState<Announcement[] | null>(null)
const [unseenData, setUnseenData] = useState<Announcement[]>([])
const [hasBeenFiltered, setHasBeenFiltered] = useState(false)
const [hasStartedFiltering, setHasStartedFiltering] = useState(false)
const config = flag<AnnouncementsConfigFlag>('home.announcements')
const { values, save } = useAnnouncementsSettings()

Expand Down Expand Up @@ -65,7 +65,8 @@ const useAnnouncements = ({
}, [client?.stackClient, config, fetchStatus, lang, values, canBeDisplayed])

useEffect(() => {
if (rawData !== null && values && !hasBeenFiltered) {
if (rawData !== null && values && !hasStartedFiltering) {
setHasStartedFiltering(true)
const uuidsSeen = values.seen ?? []
const uuidsFromApi = rawData.map(({ attributes }) => attributes.uuid)

Expand All @@ -83,9 +84,8 @@ const useAnnouncements = ({
save({ seen: uuidsInCommon })

setUnseenData(unseenData)
setHasBeenFiltered(true)
}
}, [hasBeenFiltered, rawData, values, save])
}, [hasStartedFiltering, rawData, values, save])

return unseenData
}
Expand Down
12 changes: 6 additions & 6 deletions en/cozy-home/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6280,10 +6280,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/cozy-tsconfig/-/cozy-tsconfig-1.2.0.tgz#17e61f960f139fae4d26cbac2254b9ab632b269e"
integrity sha512-TRHnY9goF3FzVlUbP7BcHxuN2XAA4AmppT4fHHZmTKaSwYTByVR1Al+riFMDbce94kJZ1wzl9WNLWQuqzGZ6Cw==

cozy-ui@^111.8.1:
version "111.8.1"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-111.8.1.tgz#589f6743811bbb0ec1e0e8ff55d65337e4752f23"
integrity sha512-jbDCUlatd1djQe5kZ0P7eufiWcf3Sm6LuKOsoAPLCppPb849ywd6cdkVkYRkt+Hzpe7k0b1sZ0+/CRg+L3Fyaw==
cozy-ui@111.9.0:
version "111.9.0"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-111.9.0.tgz#45903a91cb8cf7394f590ae544ab60e3997feb04"
integrity sha512-BDzmiUHLe1vUTGZwQApta9omiTTA17NfgpbYHhKvHDHaya+9K1i6caNLtwXzttFBliLgPe3wUFa+edsCkKKQuw==
dependencies:
"@babel/runtime" "^7.3.4"
"@material-ui/core" "4.12.3"
Expand Down Expand Up @@ -12299,9 +12299,9 @@ msgpack5@^4.0.2:
readable-stream "^2.3.6"
safe-buffer "^5.1.2"

"mui-bottom-sheet@https://github.com/cozy/mui-bottom-sheet.git#v1.0.9":
"mui-bottom-sheet@git+https://github.com/cozy/mui-bottom-sheet.git#v1.0.9":
version "1.0.8"
resolved "https://github.com/cozy/mui-bottom-sheet.git#3dc4c2a245ab39079bc2f73546bccf80847be14c"
resolved "git+https://github.com/cozy/mui-bottom-sheet.git#3dc4c2a245ab39079bc2f73546bccf80847be14c"
dependencies:
"@juggle/resize-observer" "^3.1.3"
jest-environment-jsdom-sixteen "^1.0.3"
Expand Down
2 changes: 1 addition & 1 deletion en/cozy-ui/dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,7 @@ <h1 id="screenshot-testing-locally">Screenshot testing locally<a class="headerli
<p>You have to change <code>executablePath</code> value of <code>prepareBrowser</code> function to match your OS configuration.</p>
<div class="codehilite"><pre><span></span><span class="c1"># Screenshot all the components</span>
yarn build:all
mkdir ./screenshots
mkdir -p ./screenshots
yarn screenshots
cp -r screenshots pristine_screenshots

Expand Down
3 changes: 2 additions & 1 deletion en/cozy-ui/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ module.exports = {
'../react/TextField',
'../react/Thumbnail',
'../react/Tooltip',
'../react/Typography'
'../react/Typography',
'../react/Markdown'
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion en/search/search_index.json

Large diffs are not rendered by default.

Loading

0 comments on commit f95322b

Please sign in to comment.