Skip to content

Commit

Permalink
fix issue with numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
craigrbarnes committed Feb 22, 2024
1 parent 4a335a4 commit 87e50f0
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 333 deletions.
675 changes: 376 additions & 299 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"author": "CTDS",
"description": "Core module for gen3 frontend. Provides an interface for interacting with the gen3 API and a redux store for managing state.",
"license": "Apache-2.0",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.umd.js",
Expand Down
1 change: 0 additions & 1 deletion packages/core/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const config = [
{
file: 'dist/index.esm.js',
format: 'esm',
name: 'gen3Core',
globals,
},
],
Expand Down
33 changes: 19 additions & 14 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,38 @@
"version": "0.10.3",
"description": "Gen3 frontend components, content management, and pages",
"keywords": [],
"author": "",
"author": "Center for Translational Data Science",
"license": "Apache-2.0",
"sideEffects": false,
"main": "dist/index.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.umd.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"scripts": {
"compile": "tsc",
"clean": "rimraf dist",
"rollup": "rollup --config rollup.config.mjs",
"test": "jest unit",
"test:watch": "jest unit --watch",
"test:int": "echo No integrations tests yet",
"test:all": "jest",
"types": "tsc --emitDeclarationOnly",
"copy-tailwind": "mkdir -p dist && cp src/tailwind.cjs dist/tailwind.cjs",
"copy-style": "mkdir -p dist/styles && cp src/styles/* dist/styles/",
"build": "npm run build:rollup && npm run types",
"build:clean": "npm run clean && npm run build && npm run types",
"build:rollup": "npm run compile && npm run copy-tailwind && rollup --config rollup.config.mjs",
"build:compile": "npm run compile && npm run types && npm run build:rollup",
"build:swc": "npm run compile && npm run copy-tailwind && swc src -d dist",
"build:watch": "npm run build:rollup -- --watch",
"copy-tailwind": "cp src/tailwind.cjs dist/tailwind.cjs",
"build": "npm run compile && npm run types && npm run copy-tailwind && npm run rollup",
"build:clean": "npm run clean && npm run build",
"build:watch": "npm run build -- --watch",
"dev": "npm run build:watch"
},
"exports": {
".": "./dist/index.js",
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/cjs/index.js"
}
},
"./tailwind": {
"require": "./dist/tailwind.cjs"
}
Expand All @@ -43,7 +48,7 @@
"@fontsource/montserrat": "^4.5.12",
"@fontsource/source-sans-pro": "^4.5.11",
"@graphiql/react": "^0.20.2",
"@gen3/core": "@gen3/core",
"@gen3/core": "file:../core",
"@iconify/react": "^4.0.1",
"@mantine/core": "^6.0.21",
"@mantine/form": "^6.0.21",
Expand Down
13 changes: 2 additions & 11 deletions packages/frontend/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,14 @@ const config = [
input: './src/index.ts',
output: [
{
dir: 'dist',
dir: 'dist/cjs',
format: 'cjs',
globals,
sourcemap: true
},
{
dir: 'dist',
dir: 'dist/esm',
format: 'esm',
name: 'gen3frontend',
plugins: [terser()],
globals,
sourcemap: true
},
{
dir: 'dist',
format: 'esm',
name: 'gen3Core',
globals,
sourcemap: true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const RenderArrayCell: CellRendererFunction = ({
return <span>value</span>;
};

export const RenderArrayCellNegativePositive = ({
export const RenderArrayCellNegativePositive : CellRendererFunction = ({
value,
cell,
}: CellRenderFunctionProps) => {
Expand All @@ -56,7 +56,7 @@ export const RenderArrayCellNegativePositive = ({
return <span>{value as any}</span>;
};

export const RenderLinkCell = ({ value }: CellRenderFunctionProps) => {
export const RenderLinkCell : CellRendererFunction = ({ value }: CellRenderFunctionProps) => {
const content = value as string;
return (
<Link
Expand All @@ -70,13 +70,22 @@ export const RenderLinkCell = ({ value }: CellRenderFunctionProps) => {
);
};

const RenderStringCell = ({ value }: CellRenderFunctionProps) => {
const RenderStringCell : CellRendererFunction = ({ value }: CellRenderFunctionProps, params? : JSONObject) => {
const content = value as string | string[];
if (content === undefined || content === null) {
return <Text>{`${params && params?.valueIfNotAvailable ? params?.valueIfNotAvailable : ''}`} </Text>;
}
if (content == '') {
return <Text>{`${params && params?.valueIfNotAvailable ? params?.valueIfNotAvailable : ''}`} </Text>;
}
return <Text>{isArray(content) ? content.join(', ') : content}</Text>;
};

const RenderNumberCell = ({ value }: CellRenderFunctionProps) => {
const RenderNumberCell : CellRendererFunction = ({ value }: CellRenderFunctionProps, params? : JSONObject) => {
const content = value as number | number[];
if (content === undefined || content === null) {
return <Text>{`${params && params?.valueIfNotAvailable ? params?.valueIfNotAvailable : ''}`} </Text>;
}
return (
<Text>
{isArray(content)
Expand All @@ -86,7 +95,7 @@ const RenderNumberCell = ({ value }: CellRenderFunctionProps) => {
);
};

const RenderParagraphsCell = ({ value }: CellRenderFunctionProps) => {
const RenderParagraphsCell : CellRendererFunction = ({ value }: CellRenderFunctionProps) => {
const content = value as string | string[];
return (
<React.Fragment>
Expand All @@ -108,7 +117,7 @@ interface TagData {

// TODO Fix below
// eslint-disable-next-line react/prop-types
export const RenderTagsCell = ({ value }: CellRenderFunctionProps) => {
export const RenderTagsCell : CellRendererFunction = ({ value }: CellRenderFunctionProps) => {
const content = value as TagData[];
const { discoveryConfig: config } = useDiscoveryContext();
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/sampleCommons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"getDRSToHostname": "node ../../node_modules/@gen3/toolsff/dist/getDRSToHostname.esm.js --out=config/"
},
"dependencies": {
"@gen3/core": "@gen3/core",
"@gen3/frontend": "@gen3/frontend",
"@gen3/core": "file:../core",
"@gen3/frontend": "file:../frontend",
"@mdx-js/loader": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@next/mdx": "^14.1.0",
Expand Down

0 comments on commit 87e50f0

Please sign in to comment.