Skip to content

Commit

Permalink
Merge pull request #1283 from rainlanguage/2/12/25-add-markdown-descr…
Browse files Browse the repository at this point in the history
…iptions

2/12/25 add markdown descriptions
  • Loading branch information
hardyjosh authored Feb 14, 2025
2 parents 671bc63 + 9ab0c23 commit 5c26773
Show file tree
Hide file tree
Showing 39 changed files with 937 additions and 564 deletions.
28 changes: 23 additions & 5 deletions crates/settings/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ impl_all_wasm_traits!(Gui);
pub struct NameAndDescription {
pub name: String,
pub description: String,
pub short_description: Option<String>,
}

#[cfg(target_family = "wasm")]
impl_all_wasm_traits!(NameAndDescription);

Expand Down Expand Up @@ -376,7 +378,17 @@ impl Gui {
Some("gui".to_string()),
)?;

return Ok(NameAndDescription { name, description });
let short_description = require_string(
get_hash_value(gui, "short-description", Some("gui".to_string()))?,
None,
Some("gui".to_string()),
)?;

return Ok(NameAndDescription {
name,
description,
short_description: Some(short_description),
});
}
}
Err(YamlError::Field {
Expand Down Expand Up @@ -422,8 +434,14 @@ impl Gui {
Some(location.clone()),
)?;

deployment_details
.insert(deployment_key, NameAndDescription { name, description });
deployment_details.insert(
deployment_key,
NameAndDescription {
name,
description,
short_description: None,
},
);
}
}
}
Expand Down Expand Up @@ -1474,8 +1492,8 @@ gui:
- binding: test
name: test
presets:
- value:
- test
- value:
wrong: map
"#;
let error = Gui::parse_from_yaml_optional(
vec![get_document(&format!("{yaml_prefix}{yaml}"))],
Expand Down
1 change: 1 addition & 0 deletions crates/settings/src/yaml/dotrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ mod tests {
gui:
name: Test gui
description: Test description
short-description: Test short description
deployments:
deployment1:
name: Test deployment
Expand Down
119 changes: 83 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/typography": "^0.5.16",
"@tanstack/svelte-query": "^5.59.20",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/svelte": "^5.1.0",
Expand All @@ -52,15 +53,15 @@
"jsdom": "^24.0.0",
"lodash": "^4.17.21",
"mockttp": "^3.15.1",
"postcss": "^8.4.32",
"postcss": "^8.5.2",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-tailwindcss": "^0.6.5",
"publint": "^0.2.0",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tailwind-merge": "^2.5.4",
"tailwindcss": "^3.4.9",
"tailwindcss": "^3.4.17",
"ts-node": "^10.9.1",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
Expand All @@ -83,6 +84,7 @@
"flowbite": "^2.2.1",
"flowbite-svelte": "^0.44.21",
"flowbite-svelte-icons": "^0.4.5",
"svelte-markdown": "^0.4.1",
"wagmi": "^2.14.7"
}
}
3 changes: 3 additions & 0 deletions packages/orderbook/test/js_api/gui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ const guiConfig = `
gui:
name: Fixed limit
description: Fixed limit order strategy
short-description: Buy WETH with USDC on Base.
deployments:
some-deployment:
name: Buy WETH with USDC on Base.
description: Buy WETH with USDC for fixed price on Base network.
short-description: Buy WETH with USDC on Base.
deposits:
- token: token1
min: 0
Expand Down Expand Up @@ -374,6 +376,7 @@ describe('Rain Orderbook JS API Package Bindgen Tests - Gui', async function ()
await DotrainOrderGui.getStrategyDetails(dotrainWithGui);
assert.equal(strategyDetails.name, 'Fixed limit');
assert.equal(strategyDetails.description, 'Fixed limit order strategy');
assert.equal(strategyDetails.short_description, 'Buy WETH with USDC on Base.');
});

it('should get deployment details', async () => {
Expand Down
6 changes: 6 additions & 0 deletions packages/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"import": "./dist/index.js",
"require": "./dist/index.js",
"svelte": "./dist/index.js"
},
"./services": {
"types": "./dist/services/index.d.ts",
"import": "./dist/services/index.js",
"require": "./dist/services/index.js",
"svelte": "./dist/services/index.js"
}
},
"scripts": {
Expand Down
Loading

0 comments on commit 5c26773

Please sign in to comment.