feat(admin-ui): Always show currencies overview (#4541)

* move around featureflags

* add changeset
This commit is contained in:
Philip Korsholm
2023-07-18 17:05:10 +02:00
committed by GitHub
parent d184d23c63
commit aae4b3ad37
3 changed files with 59 additions and 50 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
feat(admin-ui): always show list of currencies in currency overview
@@ -1,12 +1,14 @@
import { Currency } from "@medusajs/medusa"
import { useQueryClient } from "@tanstack/react-query"
import { adminStoreKeys, useAdminUpdateCurrency } from "medusa-react"
import { useEffect } from "react"
import { Controller, useForm } from "react-hook-form" import { Controller, useForm } from "react-hook-form"
import Switch from "../../../../components/atoms/switch" import { adminStoreKeys, useAdminUpdateCurrency } from "medusa-react"
import CoinsIcon from "../../../../components/fundamentals/icons/coins-icon" import CoinsIcon from "../../../../components/fundamentals/icons/coins-icon"
import useNotification from "../../../../hooks/use-notification" import { Currency } from "@medusajs/medusa"
import FeatureToggle from "../../../../components/fundamentals/feature-toggle"
import Switch from "../../../../components/atoms/switch"
import { getErrorMessage } from "../../../../utils/error-messages" import { getErrorMessage } from "../../../../utils/error-messages"
import { useEffect } from "react"
import useNotification from "../../../../hooks/use-notification"
import { useQueryClient } from "@tanstack/react-query"
type CurrencyTaxSettingFormType = { type CurrencyTaxSettingFormType = {
includes_tax: boolean includes_tax: boolean
@@ -70,6 +72,7 @@ const CurrencyTaxSetting = ({ currency, isDefault }: Props) => {
</div> </div>
)} )}
</div> </div>
<FeatureToggle featureFlag="tax_inclusive_pricing">
<Controller <Controller
control={control} control={control}
name="includes_tax" name="includes_tax"
@@ -85,6 +88,7 @@ const CurrencyTaxSetting = ({ currency, isDefault }: Props) => {
) )
}} }}
/> />
</FeatureToggle>
</div> </div>
</form> </form>
) )
@@ -1,16 +1,16 @@
import { useAdminStore } from "medusa-react"
import { useNavigate } from "react-router-dom"
import BackButton from "../../../components/atoms/back-button" import BackButton from "../../../components/atoms/back-button"
import Spinner from "../../../components/atoms/spinner" import CurrencyTaxSetting from "./components/currency-tax-setting"
import Tooltip from "../../../components/atoms/tooltip" import DefaultStoreCurrency from "./components/default-store-currency"
import FeatureToggle from "../../../components/fundamentals/feature-toggle" import FeatureToggle from "../../../components/fundamentals/feature-toggle"
import JSONView from "../../../components/molecules/json-view" import JSONView from "../../../components/molecules/json-view"
import Section from "../../../components/organisms/section" import Section from "../../../components/organisms/section"
import { useAnalytics } from "../../../providers/analytics-provider" import Spinner from "../../../components/atoms/spinner"
import { getErrorStatus } from "../../../utils/get-error-status"
import CurrencyTaxSetting from "./components/currency-tax-setting"
import DefaultStoreCurrency from "./components/default-store-currency"
import StoreCurrencies from "./components/store-currencies" import StoreCurrencies from "./components/store-currencies"
import Tooltip from "../../../components/atoms/tooltip"
import { getErrorStatus } from "../../../utils/get-error-status"
import { useAdminStore } from "medusa-react"
import { useAnalytics } from "../../../providers/analytics-provider"
import { useNavigate } from "react-router-dom"
const CurrencySettings = () => { const CurrencySettings = () => {
const navigate = useNavigate() const navigate = useNavigate()
@@ -77,10 +77,10 @@ const CurrencySettings = () => {
<div className="mb-large"> <div className="mb-large">
<StoreCurrencies store={store} /> <StoreCurrencies store={store} />
</div> </div>
<FeatureToggle featureFlag="tax_inclusive_pricing">
<div className="cursor-default"> <div className="cursor-default">
<div className="inter-small-semibold text-grey-50 mb-base flex items-center justify-between"> <div className="inter-small-semibold text-grey-50 mb-base flex items-center justify-between">
<p>Currency</p> <p>Currency</p>
<FeatureToggle featureFlag="tax_inclusive_pricing">
<Tooltip <Tooltip
side="top" side="top"
content={ content={
@@ -89,6 +89,7 @@ const CurrencySettings = () => {
> >
<p>Tax Incl. Prices</p> <p>Tax Incl. Prices</p>
</Tooltip> </Tooltip>
</FeatureToggle>
</div> </div>
<div className="gap-base grid grid-cols-1"> <div className="gap-base grid grid-cols-1">
{store.currencies {store.currencies
@@ -106,7 +107,6 @@ const CurrencySettings = () => {
})} })}
</div> </div>
</div> </div>
</FeatureToggle>
</Section> </Section>
</div> </div>
<div> <div>