Skip to content

Commit 2dc8a9c

Browse files
committed
chore: updates Topics UI example
1 parent a36cc23 commit 2dc8a9c

File tree

1 file changed

+34
-11
lines changed
  • packages/obc/src/components/tables/TopicsList

1 file changed

+34
-11
lines changed

packages/obc/src/components/tables/TopicsList/example.ts

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
/* MD
2+
## Showing BCF Topics the Easy Way ✨
3+
---
4+
Integration with BIM Collaboration Format is probably one of those features you want to have in your app sooner than later. Problem is, many UIs are needed (one to display the topics, another to create them, another to edit everything, etc). Well, hold tight as here you will learn all you need to know in order to use the power of UI Components to accomplish a fully working user interface for your next BCF integration!
5+
6+
### 🏗 Scaffolding the Application
7+
First of all, let's import the dependencies we need to get this working:
8+
*/
9+
110
// eslint-disable-next-line import/no-extraneous-dependencies
211
import * as CUI from "@thatopen/ui-obc";
312
import * as BUI from "@thatopen/ui";
413
import * as OBC from "@thatopen/components";
514

15+
/* MD
16+
Next, it's always necessary to initialize the core UI library no matter if you're using functional components from `@thatopen/ui-obc`. Also, let's setup `@thatopen/components` with the minimum things to get a [World](/Tutorials/Components/Core/Worlds) up and running to load models.
17+
*/
18+
619
BUI.Manager.init();
720

821
const viewport = document.createElement("bim-viewport");
@@ -34,12 +47,8 @@ const grids = components.get(OBC.Grids);
3447
grids.create(world);
3548

3649
/* MD
37-
## Showing BCF topics the easy way ☪☪
38-
---
39-
Integration with BIM Collaboration Format is probably one of those features you want to have in your app sooner than later. Problem is, many UIs are needed (one to display the topics, another to create them, another to edit everything, etc). Well, hold tight as here you will learn all you need to know in order to use the power of UI Components to accomplish a fully working user interface for your next BCF integration!
40-
41-
### Loading a model and setting up the topics component
42-
First things first... let's load a model 👇
50+
### 🏦 Loading a Model and Setting the BCFTopics
51+
Just after setting up the world, let's programatically load a model 👇
4352
*/
4453

4554
const ifcLoader = components.get(OBC.IfcLoader);
@@ -100,17 +109,31 @@ topics.list.onItemSet.add(({ value: topic }) => {
100109
/* MD
101110
Once the BCFTopics component has been initialized, let's see how to setup a plug-n-play UI for it! The BIM Components UI package (@thatopen/ui-obc) comes with some UIs to support the usage of the BCFTopics component. Among the components you got:
102111
112+
103113
👉 TopicsList: a table to display the topics created with the component (or the ones you choose to see).
114+
115+
104116
👉 TopicForm: a form to create new or update existing topics.
117+
118+
105119
👉 TopicComments: a table to display the list of comments for a single topic.
120+
121+
106122
👉 TopicCommentsSection: an element to display the comments for a single topic and also a text area to add them.
123+
124+
107125
👉 TopicInformationSection: an element to display the topic markup information and a button with the form included to update it.
126+
127+
108128
👉 TopicRelationsSection: an element to display the topics related with another and the functionality to link them.
129+
130+
109131
👉 TopicViewpointsSection: an element to display the topics viewpoints with the functionality create new or link existing viewpoints.
110132
133+
111134
Is entirely up to you what to use, but using them together gives you a ready to go UI with everything you need to have a production ready BCF integration in your BIM app! Let's start with the topics list table.
112135
113-
### Topics List
136+
### 🔨 Displaying the Topics List in a Table
114137
The topics list table is the easiest way to display all topics created in the app using the BCFTopics component. Creating it is really simple, as you just need to write the following:
115138
*/
116139

@@ -125,7 +148,7 @@ topicsList.selectableRows = true;
125148
/* MD
126149
That's it. You don't need anything else other than creating an instance of the UI component and place it anywhere you want in the app. The table updates by it-self anytime a new topic has been created or modified!
127150
128-
### Topic Form
151+
### 📃 Using the Topics Form UI
129152
Let's now define a topic form so creating them is easier than ever:
130153
*/
131154

@@ -178,7 +201,7 @@ updateTopicForm({
178201
/* MD
179202
Awesome! Topic form setup correctly 😎
180203
181-
### Creating a Custom Topic Panel
204+
### 🎫 Creating a Custom Topic Panel
182205
With the form set up, what if we use the topic panel to see it's full information? Typically, you will display the full information for one topic at the same time; in such case, you only need to create one topic panel component. However, you can create as many panels as you need. In this tutorial we will create one as follows:
183206
*/
184207

@@ -308,7 +331,7 @@ updateTopicsList({
308331
});
309332

310333
/* MD
311-
### Creating a Button to Download BCFs
334+
### Creating a Button to Download BCFs
312335
To complete our BCF integration, let's create a button to download the topics created using the BCFTopics component:
313336
*/
314337

@@ -341,7 +364,7 @@ const downloadBtn = BUI.Component.create(() => {
341364
});
342365

343366
/* MD
344-
### Creating a Panel to Append the Table
367+
### 🥅 Creating a Panel to Hold the Table
345368
Let's now create a BIM Panel to hold the topics list while also adding the corresponding buttons to trigger the functionalities like showing the form and downloading the BCF file:
346369
*/
347370

0 commit comments

Comments
 (0)