Skip to content

Commit

Permalink
Merge branch 'develop' into fix/include-bools-address
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl authored Jan 15, 2025
2 parents 350213c + 65bf6e4 commit 0fa5254
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 24 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test-cli-with-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
node-version: 20

- name: Install Medusa cli
run: npm i -g @medusajs/cli@preview
run: npm i -g @medusajs/cli@latest

- name: Create Medusa project
run: |
Expand All @@ -59,22 +59,22 @@ jobs:
working-directory: ../cli-test

- name: Run migrations
run: medusa db:migrate
run: npx medusa db:migrate
working-directory: ../cli-test

- name: Create admin user
run: medusa user -e [email protected] -p password -i admin_123
run: npx medusa user -e [email protected] -p password -i admin_123
working-directory: ../cli-test

- name: Run development server
run: medusa develop &
run: npx medusa develop &
working-directory: ../cli-test

- name: Testing development server
uses: ./.github/actions/test-server

- name: Starting medusa
run: medusa start &
run: npx medusa start &
working-directory: ../cli-test

- name: Testing server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>

- [`Product` data model \<\> `Cart` data model of Cart Module](#cart-module). (Read-only).
- [`Product` data model \<\> `InventoryItem` data model of Inventory Module](#inventory-module).
- [`ProductVariant` data model \<\> `InventoryItem` data model of Inventory Module](#inventory-module).
- [`Product` data model \<\> `Order` data model of Order Module](#order-module). (Read-only).
- [`ProductVariant` data model \<\> `PriceSet` data model of Pricing Module](#pricing-module).
- [`Product` data model \<\> `SalesChannel` data model of Sales Channel Module](#sales-channel-module).
Expand Down Expand Up @@ -413,4 +413,4 @@ createRemoteLinkStep({
```

</CodeTab>
</CodeTabs>
</CodeTabs>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React, { useEffect, useMemo, useRef, useState } from "react"
import { WorkflowStepUi } from "types"
import { InlineCode, MarkdownContent, Tooltip } from "../../.."
import { Bolt, InformationCircle } from "@medusajs/icons"
import { getBrowser } from "../../../../utils"

export type WorkflowDiagramNodeProps = {
step: WorkflowStepUi
Expand Down Expand Up @@ -34,12 +35,22 @@ export const WorkflowDiagramStepNode = ({ step }: WorkflowDiagramNodeProps) => {
return
}

const firstChild = nodeParent.firstChild as HTMLElement

const nodeBoundingRect = nodeParent.getBoundingClientRect()
const diagramBoundingRect = diagramParent.getBoundingClientRect()
const browser = getBrowser()

setOffset(
Math.max(diagramBoundingRect.width - nodeBoundingRect.width + 10, 10)
)
if (browser === "Safari") {
// React Tooltip has a bug in Safari where the offset is not calculated correctly
// when place is set.
const firstChildBoundingRect = firstChild.getBoundingClientRect()
setOffset(diagramBoundingRect.width - firstChildBoundingRect.width + 20)
} else {
setOffset(
Math.max(diagramBoundingRect.width - nodeBoundingRect.width + 10, 10)
)
}
}, [ref.current])

return (
Expand Down
8 changes: 0 additions & 8 deletions www/packages/docs-ui/src/utils/get-os-shortcut.ts

This file was deleted.

2 changes: 1 addition & 1 deletion www/packages/docs-ui/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export * from "./decode-str"
export * from "./dom-utils"
export * from "./get-link-with-base-path"
export * from "./get-navbar-items"
export * from "./get-os-shortcut"
export * from "./os-browser-utils"
export * from "./get-scrolled-top"
export * from "./is-elm-window"
export * from "./is-in-view"
Expand Down
39 changes: 39 additions & 0 deletions www/packages/docs-ui/src/utils/os-browser-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export function getBrowser():
| "Chrome"
| "Safari"
| "Firefox"
| "Internet Explorer"
| "Edge"
| "unknown" {
if (typeof navigator === "undefined") {
return "unknown"
}

const userAgent = navigator.userAgent.toLowerCase()

if (userAgent.indexOf("chrome") > -1) {
return "Chrome"
} else if (userAgent.indexOf("safari") > -1) {
return "Safari"
} else if (userAgent.indexOf("firefox") > -1) {
return "Firefox"
} else if (
userAgent.indexOf("msie") > -1 ||
userAgent.indexOf("trident") > -1
) {
return "Internet Explorer"
} else if (userAgent.indexOf("edge") > -1) {
return "Edge"
} else {
return "unknown"
}
}

export function getOsShortcut() {
const isMacOs =
typeof navigator !== "undefined"
? navigator.userAgent.toLowerCase().indexOf("mac") !== 0
: true

return isMacOs ? "⌘" : "Ctrl"
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ function getStep({
return {
type,
name: document.name,
description: associatedReflection?.comment
? Handlebars.helpers.comments(associatedReflection.comment, true)
: "",
description: associatedReflection?.comment?.summary
? Handlebars.helpers.comment(associatedReflection.comment.summary)
: associatedReflection?.comment
? Handlebars.helpers.comments(associatedReflection.comment, true)
: "",
link:
type === "hook" || !associatedReflection?.url
? `#${document.name}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default function () {
} else {
exampleTags.forEach((exampleTag) => {
exampleTag.content.forEach((part) => {
if (part.kind !== "code") {
if (
part.kind !== "code" ||
part.text.startsWith("```ts workflow={false}")
) {
exampleStr.push(part.text)
return
}
Expand Down
7 changes: 6 additions & 1 deletion www/utils/packages/utils/src/examples-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,15 @@ export function getFakeStrValue({
`id_${faker.string.alphanumeric({
length: { min: 10, max: 20 },
})}`,
region_id: "reg_123",
product_id: "prod_123",
cart_id: "cart_123",
order_id: "order_123",
name: () => faker.person.firstName(),
email: () => faker.internet.email(),
password: () => faker.internet.password({ length: 8 }),
currency: () => faker.finance.currencyCode(),
currency_code: () => faker.finance.currencyCode().toLowerCase(),
country_code: () => faker.location.countryCode().toLowerCase(),
title: () => faker.lorem.word(),
description: () => faker.lorem.sentence(),
url: () => faker.internet.url(),
Expand Down

0 comments on commit 0fa5254

Please sign in to comment.