Skip to content

Commit ab113d9

Browse files
committed
first working round
1 parent c306589 commit ab113d9

File tree

41 files changed

+1438
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1438
-307
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"prj-husky-init": "rimraf .husky && husky install && husky add .husky/pre-commit \"npm run pre-commit\"",
4747
"prj-bs": "lerna bootstrap --hoist",
4848
"dev-assistant": "lerna run --parallel --stream dev-assistant --",
49-
"prj-build": "tsc --build packages/arangodb packages/component-library packages/system-entities packages/core packages/crypto packages/email-service packages/extensions-manager packages/http-server packages/key-value-store packages/organization packages/react-app packages/simple-email-auth packages/ed-resource packages/collection packages/ed-meta packages/simple-file-store packages/openid packages/web-user packages/unsplash packages/moodle-lms-integration packages/mn-central-jira-simple-moderations packages/core-domain packages/openai-autofill",
49+
"prj-build": "tsc --build packages/arangodb packages/component-library packages/system-entities packages/core packages/crypto packages/email-service packages/extensions-manager packages/http-server packages/key-value-store packages/organization packages/react-app packages/simple-email-auth packages/ed-resource packages/collection packages/ed-meta packages/simple-file-store packages/openid packages/web-user packages/unsplash packages/moodle-lms-integration packages/mn-central-jira-simple-moderations packages/core-domain packages/openai-autofill packages/web-user-auto-publisher",
5050
"prj-build-watch": "npm run prj-build -- --watch",
5151
"prj-build-clean": "npm run prj-build -- --clean",
5252
"dev-install-backend": "node bin/install.mjs",

packages/component-library/src/common/utilities.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
/* eslint-disable prefer-const */
12
import defaultsDeep from 'lodash/defaultsDeep.js'
23
import type { PartialDeep } from 'type-fest'
34

5+
export const getDomainUrl = (url: string): string | undefined => {
6+
try {
7+
return new URL(url).hostname.replace('www.', '')
8+
} catch (e) {
9+
return undefined
10+
}
11+
}
12+
413
export const overrideDeep = <T>(base: T, overrides: PartialDeep<T> | undefined): T => {
514
return defaultsDeep(overrides, base)
615
}

packages/component-library/src/webapp/ui/helpers/utilities.tsx

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import assert from 'assert'
22
import type { ReactElement } from 'react'
33
import { useEffect, useMemo, useState } from 'react'
4+
import { getDomainUrl } from '../../../common.mjs'
45
import type { AssetInfo } from '../../../common/types.mjs'
56
import type { AddonItem } from '../../../ui.mjs'
67
import { getYouTubeEmbed, getYouTubeThumbnail } from '../../../ui.mjs'
@@ -164,14 +165,6 @@ export const getThumbnailFromUrl = (url: string): ThumbnailType => {
164165
}
165166
}
166167

167-
export const getDomainUrl = (url: string): string | undefined => {
168-
try {
169-
return new URL(url).hostname.replace('www.', '')
170-
} catch (e) {
171-
return undefined
172-
}
173-
}
174-
175168
export const sortAddonItems = (
176169
items: (AddonItem | JSX.Element | null | boolean)[],
177170
): (AddonItem | JSX.Element)[] => {

packages/ed-resource/src/common/types.mts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { IconTextOptionProps, TextOptionProps } from '@moodlenet/component-library'
2-
import { getDomainUrl } from '@moodlenet/component-library'
2+
import { getDomainUrl } from '@moodlenet/component-library/common'
33
import type { StateName } from '@moodlenet/core-domain/resource'
44
import type { Href } from '@moodlenet/react-app/common'
55
// import { AuthDataRpc } from '@moodlenet/web-user/common'

packages/storybook/src/components/pages/Emails/FirstContributionEmail.stories._tsx

-24
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// FirstContributionEmail.stories.js
2+
import { render } from '@react-email/render'
3+
import type { FirstContributionEmailProps } from '../../../../../web-user/src/common/emails/FirstContributionEmail/FirstContributionEmail.js'
4+
import FirstContributionEmail from '../../../../../web-user/src/common/emails/FirstContributionEmail/FirstContributionEmail.js'
5+
6+
export default {
7+
title: 'Pages/Emails/Publisher/FirstContribution',
8+
// component: FirstContributionEmail,
9+
parameters: { layout: 'no-wrapper' },
10+
}
11+
12+
const EmailTemplate = () => {
13+
const props: FirstContributionEmailProps = {
14+
instanceName: 'MoodleNet',
15+
actionUrl: 'https://moodle.net/changepassword',
16+
}
17+
18+
const html = render(<FirstContributionEmail {...props} />)
19+
20+
return <div style={{ height: '100%' }} dangerouslySetInnerHTML={{ __html: html }} />
21+
}
22+
23+
export const Default = EmailTemplate.bind({})

packages/storybook/src/components/pages/Emails/NewPublisherEmail.stories._tsx

-26
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// NewPublisherEmail.stories.js
2+
import { render } from '@react-email/render'
3+
import {
4+
NewPublisherEmail,
5+
type NewPublisherEmailProps,
6+
} from '../../../../../web-user/src/common/emails/NewPublisherEmail/NewPublisherEmail.js'
7+
8+
export default {
9+
title: 'Pages/Emails/Publisher/NewPublisher',
10+
component: NewPublisherEmail,
11+
parameters: { layout: 'no-wrapper' },
12+
}
13+
14+
const EmailTemplate = () => {
15+
const props: NewPublisherEmailProps = {
16+
instanceName: 'MoodleNet',
17+
actionUrl: 'https://moodle.net/changepassword',
18+
}
19+
20+
const html = render(<NewPublisherEmail {...props} />)
21+
22+
return <div style={{ height: '100%' }} dangerouslySetInnerHTML={{ __html: html }} />
23+
}
24+
25+
export const Default = EmailTemplate.bind({})

packages/storybook/src/components/pages/Emails/SecondContributionEmail.stories._tsx

-26
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SecondContributionEmail.stories.js
2+
import { render } from '@react-email/render'
3+
import {
4+
SecondContributionEmail,
5+
type SecondContributionEmailProps,
6+
} from '../../../../../web-user/src/common/emails/Publisher/SecondContributionEmail/SecondContributionEmail.js'
7+
8+
export default {
9+
title: 'Pages/Emails/Publisher/SecondContribution',
10+
component: SecondContributionEmail,
11+
parameters: { layout: 'no-wrapper' },
12+
}
13+
14+
const EmailTemplate = () => {
15+
const props: SecondContributionEmailProps = {
16+
actionUrl: 'https://moodle.net/changepassword',
17+
}
18+
19+
const html = render(<SecondContributionEmail {...props} />)
20+
console.log('html', html)
21+
22+
return <div style={{ height: '100%' }} dangerouslySetInnerHTML={{ __html: html }} />
23+
}
24+
25+
export const Default = EmailTemplate.bind({})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/tsconfig.tsbuildinfo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Dev Notes
2+
3+
## Exploring clean architecture pattern
4+
5+
Given the simplicity of this feature package, I take the chance to explore a clean-architecture pattern implementation Particularly, Primary-Ctrl-Secondary message flow and structure

0 commit comments

Comments
 (0)