Skip to content

Commit

Permalink
Merge branch 'main' of github.com:island-is/island.is into j-s/court-…
Browse files Browse the repository at this point in the history
…abbr
  • Loading branch information
oddsson committed Nov 28, 2024
2 parents b2b82b4 + 0de2db5 commit a9522a5
Show file tree
Hide file tree
Showing 24 changed files with 1,057 additions and 72 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ jobs:
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: true
level: info
fail-level: info
exclude: >-
*/node_modules/*
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/revert-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Checksuit

on:
workflow_run:
workflows:
- Monorepo pipeline - build and deploy
types:
- completed
branches:
- main
pull_request:
types:
- opened
- synchronize
- labeled

permissions:
contents: write
pull-requests: write

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
detect-failure:
name: Determine Failure
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
outputs:
PR_NUMBER: ${{ steps.fetch-pr.outputs.PR_NUMBER }}
steps:
- uses: actions/checkout@v4

- name: Debug
run: |
echo "Conclusion: ${{ github.event.workflow_run.conclusion }}"
- name: Fetch PR
id: fetch-pr
run: |
COMMIT_SHA="${{ github.event.workflow_run.head_commit.id }}"
if ! PR_NUMBER=$(bash ./scripts/ci/get-pr.sh "$COMMIT_SHA"); then
echo "Error: Failed to get PR number for commit $COMMIT_SHA"
exit 1
fi
if [ -n "$PR_NUMBER" ]; then
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
else
echo "No merged PR found for commit $COMMIT_SHA."
fi
- name: Add Revert Label
id: add-revert-label
if: ${{ steps.fetch-pr.outputs.PR_NUMBER && github.event.workflow_run.conclusion == 'failure' }}
run: |
PR_NUMBER="${{ steps.fetch-pr.outputs.PR_NUMBER }}"
if [ -z "$PR_NUMBER" ]; then
echo "Error: PR number is empty"
exit 1
fi
echo "Adding revert label to PR: $PR_NUMBER"
if ! gh pr edit "$PR_NUMBER" --add-label "revert"; then
echo "Error: Failed to add revert label"
exit 1
fi
create-revert-pr:
name: Automated PR revert
needs: detect-failure
if: ${{ needs.detect-failure.outputs.PR_NUMBER && github.event.workflow_run.conclusion == 'failure' }}
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
steps:
- name: Debug
run: |
PR_NUMBER=${{ needs.detect-failure.outputs.PR_NUMBER }}
echo "Reverting PR: $PR_NUMBER"
- name: Execute PR revert
if: ${{ vars.ENABLE_PR_REVERT == 'true' }}
run: |
REVERT_PR=$(bash ./scripts/ci/revert-pr.sh "$PR_NUMBER")
gh pr edit $REVERT_PR --add-label "automerge,high priority"
manual-revert-pr:
name: Manual PR revert
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
if: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'revert') && (github.event.pull_request.merged == true || github.event.pull_request.draft == true) && github.actor != 'github-actions' }}
steps:
- name: Debug
run: |
echo "actor: ${{ github.actor }}"
echo "Reverting PR: ${{ github.event.pull_request.number }}"
- name: Execute PR revert
if: ${{ vars.ENABLE_PR_REVERT == 'true' }}
run: |
REVERT_PR=$(bash ./scripts/ci/revert-pr.sh "${{ github.event.pull_request.number }}")
gh pr edit $REVERT_PR --add-label "automerge,high priority"
13 changes: 7 additions & 6 deletions apps/web/components/ChatPanel/BoostChatPanel/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { theme } from '@island.is/island-ui/theme'

import { BoostChatPanelConfig } from './types'

export const boostChatPanelEndpoints = {
// Sýslumenn organization
// https://app.contentful.com/spaces/8k0h54kbe6bj/entries/kENblMMMvZ3DlyXw1dwxQ
kENblMMMvZ3DlyXw1dwxQ: {
id: 'syslumenn',
conversationKey: 'syslumenn',
url: 'https://syslumenn.boost.ai/chatPanel/chatPanel.js',
// Vinnumálastofnun organization
//https://app.contentful.com/spaces/8k0h54kbe6bj/entries/co6SSvHZjUpEICpTlJT1B
co6SSvHZjUpEICpTlJT1B: {
id: '313vinnumalastofnun',
conversationKey: '313vinnumalastofnun',
url: 'https://313vinnumalastofnun.boost.ai/chatPanel/chatPanel.js',
},
}

Expand Down
7 changes: 5 additions & 2 deletions apps/web/components/LanguageToggler/LanguageToggler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ export const LanguageToggler = ({
<DialogPrompt
baseId={dialogId}
initialVisibility={true}
title={gn('switchToEnglishModalTitle')}
description={gn('switchToEnglishModalText')}
title={gn('switchToEnglishModalTitle', 'Translation not available')}
description={gn(
'switchToEnglishModalText',
'The page you are viewing does not have an English translation yet',
)}
ariaLabel="Confirm switching to english"
disclosureElement={Disclosure}
onConfirm={() => {
Expand Down
43 changes: 36 additions & 7 deletions apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
} from '@island.is/island-ui/core'
import { theme } from '@island.is/island-ui/theme'
import {
BoostChatPanel,
boostChatPanelEndpoints,
DefaultHeaderProps,
Footer as WebFooter,
HeadWithSocialSharing,
Expand Down Expand Up @@ -957,6 +959,20 @@ export const OrganizationChatPanel = ({
)
}

const organizationIdWithBoost = organizationIds.find((id) => {
return id in boostChatPanelEndpoints
})

if (organizationIdWithBoost) {
return (
<BoostChatPanel
endpoint={
organizationIdWithBoost as keyof typeof boostChatPanelEndpoints
}
/>
)
}

return null
}

Expand Down Expand Up @@ -1087,8 +1103,7 @@ export const OrganizationWrapper: React.FC<
const router = useRouter()
const { width } = useWindowSize()
const [isMobile, setIsMobile] = useState<boolean | undefined>()
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore make web strict

usePlausiblePageview(organizationPage.organization?.trackingDomain)

useEffect(() => {
Expand All @@ -1114,6 +1129,18 @@ export const OrganizationWrapper: React.FC<

const sidebarCards = organizationPage.sidebarCards ?? []

const namespace = useMemo(() => {
try {
return JSON.parse(
organizationPage.organization?.namespace?.fields || '{}',
)
} catch {
return {}
}
}, [organizationPage.organization?.namespace?.fields])

const n = useNamespace(namespace)

return (
<>
<HeadWithSocialSharing
Expand Down Expand Up @@ -1382,11 +1409,13 @@ export const OrganizationWrapper: React.FC<
/>
</Box>
)}
<OrganizationChatPanel
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore make web strict
organizationIds={[organizationPage?.organization?.id]}
/>
{n('enableOrganizationChatPanelForOrgPages', true) && (
<OrganizationChatPanel
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore make web strict
organizationIds={[organizationPage?.organization?.id]}
/>
)}
</>
)
}
2 changes: 1 addition & 1 deletion apps/web/hooks/usePlausiblePageview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { publicRuntimeConfig = {} } = getConfig() ?? {}

let newestVisitedUrl = ''

export const usePlausiblePageview = (domain?: string) => {
export const usePlausiblePageview = (domain?: string | null) => {
const router = useRouter()

useEffect(() => {
Expand Down
37 changes: 21 additions & 16 deletions apps/web/layouts/organization/standalone/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useWindowSize } from 'react-use'

import {
Box,
GridColumn,
Expand All @@ -8,6 +10,7 @@ import {
LinkV2,
Text,
} from '@island.is/island-ui/core'
import { theme } from '@island.is/island-ui/theme'
import { LanguageToggler, SearchInput } from '@island.is/web/components'
import { useI18n } from '@island.is/web/i18n'

Expand All @@ -33,36 +36,38 @@ export const Navigation: React.FC<React.PropsWithChildren<NavigationProps>> = ({
organizationSlug,
}) => {
const { activeLocale } = useI18n()
const { width } = useWindowSize()

return (
<GridContainer>
<GridRow className={styles.gridRow} alignItems="center">
<GridColumn span="3/12">
<GridColumn span={['6/12', '6/12', '6/12', '3/12']}>
<LinkV2 href={homeHref}>
<Inline space={3} alignY="center" flexWrap="nowrap">
<Inline space={[2, 2, 3]} alignY="center" flexWrap="nowrap">
{!!logo && (
<img src={logo} alt={logoAltText} className={styles.logo} />
)}
<Text variant="h2" as="h1">
<Text
variant={width < theme.breakpoints.sm ? 'h3' : 'h2'}
as="h1"
>
{title}
</Text>
</Inline>
</LinkV2>
</GridColumn>
<GridColumn span="6/12">
<Hidden below="lg">
<Inline space={3} alignY="center" justifyContent="center">
{links.map((link) => (
<LinkV2 key={link.label} href={link.href}>
<Text variant="h4" color="blue600">
{link.label}
</Text>
</LinkV2>
))}
</Inline>
</Hidden>
<GridColumn span="6/12" hiddenBelow="lg">
<Inline space={3} alignY="center" justifyContent="center">
{links.map((link) => (
<LinkV2 key={link.label} href={link.href}>
<Text variant="h4" color="blue600">
{link.label}
</Text>
</LinkV2>
))}
</Inline>
</GridColumn>
<GridColumn span="3/12">
<GridColumn span={['6/12', '6/12', '6/12', '3/12']}>
<Hidden below="lg">
<Box display="flex" alignItems="center" justifyContent="flexEnd">
<SearchInput
Expand Down
5 changes: 3 additions & 2 deletions apps/web/layouts/organization/standalone/standalone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SkipToMainContent,
} from '@island.is/web/components'
import { PRELOADED_FONTS } from '@island.is/web/constants'
import { GlobalContextProvider } from '@island.is/web/context'
import { OrganizationPage } from '@island.is/web/graphql/schema'
import { useLinkResolver } from '@island.is/web/hooks'
import { useI18n } from '@island.is/web/i18n'
Expand Down Expand Up @@ -87,7 +88,7 @@ export const StandaloneLayout = ({
const featuredImage = seo?.image ?? organizationPage.featuredImage

return (
<>
<GlobalContextProvider>
<Head>
{PRELOADED_FONTS.map((href, index) => {
return (
Expand Down Expand Up @@ -270,6 +271,6 @@ export const StandaloneLayout = ({
url('/fonts/ibm-plex-sans-v7-latin-600.woff') format('woff');
}
`}</style>
</>
</GlobalContextProvider>
)
}
Loading

0 comments on commit a9522a5

Please sign in to comment.