1
00:00:01,190 --> 00:00:05,510
As we were riding out these different action interfaces, we started making some really big assumptions

2
00:00:05,510 --> 00:00:08,119
about the different properties that a cell would have.

3
00:00:08,420 --> 00:00:13,000
So clearly we are now assuming that a cell inside replication is going to have an ID property.

4
00:00:13,400 --> 00:00:18,050
We're kind of also assuming that a cell might have a type property that describes if it's for code or

5
00:00:18,050 --> 00:00:18,500
text.

6
00:00:18,800 --> 00:00:22,670
And we're also really assuming that a cell is going to have a content property as well.

7
00:00:23,210 --> 00:00:27,770
So at this point in time, I think that we might want to create another interface inside of maybe another

8
00:00:27,770 --> 00:00:29,420
file inside of our state directory.

9
00:00:29,690 --> 00:00:33,320
And maybe this interface should describe exactly what a cell is.

10
00:00:33,620 --> 00:00:34,750
So what is a cell?

11
00:00:35,030 --> 00:00:36,460
What properties does it have?

12
00:00:36,830 --> 00:00:41,300
We can create one interface to describe this and then start to share those different properties or make

13
00:00:41,300 --> 00:00:45,530
use of that interface around all these different parts of our redux application.

14
00:00:46,370 --> 00:00:53,150
So inside of my state's directory, I'm going to make a new file called Cell, and inside of here I'm

15
00:00:53,150 --> 00:00:55,700
going to define and export in interface.

16
00:00:59,740 --> 00:01:01,480
That I will call simply sell.

17
00:01:03,250 --> 00:01:07,720
So on this interface will describe all the different properties we expect to sell to have.

18
00:01:08,080 --> 00:01:12,340
Well, I think that a sale should probably have an ID so we can uniquely identify each one.

19
00:01:12,820 --> 00:01:17,890
I think that it should probably have maybe a type that will be either code or text.

20
00:01:18,250 --> 00:01:22,730
And again, this is going to say, is this a code cell or is it a markdown documentation cell?

21
00:01:23,440 --> 00:01:27,780
And then finally, we can have maybe content or data doesn't really make a big difference.

22
00:01:27,790 --> 00:01:29,990
I think content probably makes a lot of sense.

23
00:01:30,010 --> 00:01:36,250
You're so content will be the code in a code cell or the text for a text cell.

24
00:01:36,900 --> 00:01:41,350
And I think in total, these are probably all the properties we really need to describe an individual

25
00:01:41,350 --> 00:01:41,710
cell.

26
00:01:43,120 --> 00:01:48,130
Now that we've got this interface put together, we might want to try to better define or have a better

27
00:01:48,130 --> 00:01:52,690
way of referencing the type, for example, or content or all these different things.

28
00:01:52,840 --> 00:01:58,990
Back inside of our action file, for example, we now have kind of a duplicate definition around what

29
00:01:58,990 --> 00:02:02,080
possible types of cells there are inside of insert cell.

30
00:02:02,080 --> 00:02:02,820
Before action.

31
00:02:02,830 --> 00:02:07,030
We had put the typewrite here and we had said clearly that we are kind of assuming that there are two

32
00:02:07,030 --> 00:02:10,320
kinds of cells available to us, a code cell in a text cell.

33
00:02:10,930 --> 00:02:15,130
So we're defining that in one place and then defining that over inside of our cell interface as well.

34
00:02:15,670 --> 00:02:19,830
So what would happen if in one location we have text and in the other location we have markdown?

35
00:02:20,230 --> 00:02:24,460
Well, now all of a sudden these two interfaces are not really compatible in any in any way.

36
00:02:25,620 --> 00:02:32,130
Because for one, it's saying that we can have a cell of type text, but our canonical or like the official

37
00:02:32,130 --> 00:02:37,410
concrete definition of what a cell is, is saying, hey, we can actually have code and markdown, not

38
00:02:37,410 --> 00:02:37,810
text.

39
00:02:38,280 --> 00:02:42,840
So, again, we might want to create just one single location that says here are the different possible

40
00:02:42,840 --> 00:02:44,590
types of cells we can have.

41
00:02:45,300 --> 00:02:48,840
So for that, we might might want to create another type up top and export it.

42
00:02:49,380 --> 00:02:51,630
We call it maybe cell types.

43
00:02:53,000 --> 00:02:53,990
And have this be.

44
00:02:55,180 --> 00:03:03,430
Something like code meat, we export type, there we go, OWD or text, and now we could refer to that

45
00:03:03,640 --> 00:03:04,420
right here.

46
00:03:06,550 --> 00:03:09,280
We could import this into our actions definition file.

47
00:03:10,140 --> 00:03:11,730
So at the very top, I can import.

48
00:03:13,200 --> 00:03:17,730
Cell types from up on directory cell.

49
00:03:18,750 --> 00:03:21,150
And then refer to that right here as well.

50
00:03:23,910 --> 00:03:29,180
So now, if we ever decide to define additional cell types and cyber application, for example, right

51
00:03:29,180 --> 00:03:31,730
now code is really kind of implicitly always JavaScript.

52
00:03:31,940 --> 00:03:34,840
Maybe we decide to also support other kinds of code cells as well.

53
00:03:34,850 --> 00:03:36,860
So maybe Java or Python or something.

54
00:03:37,100 --> 00:03:41,720
Well, then we can very easily redefine this and say, oh, yeah, we can have a JavaScript type cell

55
00:03:41,870 --> 00:03:46,400
and a Java type cell, a text cell, maybe an HTML cell and so on.

56
00:03:46,730 --> 00:03:49,580
And we can make all these updates and just this one single location.

57
00:03:50,750 --> 00:03:52,430
So I think that this is definitely a good improvement.

58
00:03:53,790 --> 00:03:54,960
OK, so this looks pretty good.

59
00:03:55,170 --> 00:03:59,970
We now have a single location that says here's exactly what a cell is now.

60
00:04:00,000 --> 00:04:03,630
We've put this together, as I mentioned, another quick pause and we'll come back and start taking

61
00:04:03,630 --> 00:04:06,980
care of our reducers and our different action creators as well.

