Skip to content

Commit

Permalink
Merge branch 'collapse'
Browse files Browse the repository at this point in the history
* collapse: (21 commits)
  Cleanup: update TODO
  Cleanup: elm-review
  Collapse: update README
  Collapse: fix horizontal scroll issue
  Collapse: better working with RTL text (I hope)
  Collapse: reduce column padding-top as gap looks biiig when collapsed
  Collapse: save new example config
  Collapse: better alignment of arrow and column title
  Collapse: CollapseState -> CollapsedColumns
  Collapse: save collumn collapse state (in settings)
  Collapse: ensure a collapsed column stays collapsed
  Collapse: show number of cards in collapsed column
  Collapse: fix the width of columns
  Collapse: don't display cards in collapsed columns
  Collapse: collapse/uncollapse when click on control
  Collapse: CollapseStates to track collapsed columns (render only)
  Collapse: use pointer cursor when over marker triangle
  Collapse: add arrow collapse state marker and align column title
  Collapse: switch to flexbox to show collapsed columns
  Collapse: empty columns are collapsed (intially anyway)
  ...
  • Loading branch information
roovo committed Jan 30, 2023
2 parents 986ec24 + 2b1d243 commit 37a0124
Show file tree
Hide file tree
Showing 23 changed files with 1,554 additions and 528 deletions.
18 changes: 9 additions & 9 deletions README.md
Expand Up @@ -15,14 +15,16 @@ An [Obsidian](https://obsidian.md/) plugin to make working with tasks a pleasure
- Tag based (uses `#tags` to define your boards).

## New
- Collapseable columns. To make this work nicely, columns are now set to a fixed width.
See the [Scaling Board Text and Column Sizes section](#scaling-board-text-and-column-sizes)
to customize this if you don't like the width I have chosen.
- Supports all valid CommonMark unordered list markers (`-`, `+`, `*`) -> @MattiasMartens.
- Option to choose whether to apply tag filters to top level tasks, sub-tasks, or
both.
- Clean-up of many edge cases that led to odd behavior such as cards vanishing
from boards when marked as complete, or the information on a card changing depending
which column it was displayed in. If you are used to the way things used to work
you may well notice a change (hopefully for the best).
- Sub-task tags now shown inline rather than at the top of the card.

![date based board screenshot](/images/dateBoard.png?raw=true)

Expand Down Expand Up @@ -319,23 +321,21 @@ To get the correct behavior for recurring tasks, click the edit icon on the card
to go to the file where the task is written, and then use the
*"Tasks: Toggle Done"* command or click the checkbox from there.

## Scaling Board Size
You can scale the size of the board relative to the size of stuff in Obsidian using
a css snippet:
## Scaling Board Text and Column Sizes
Use the following css snippet to customize these:

```css
.card-board-view {
font-size: 1em;
}

.card-board-view .card-board-columns {
grid-auto-columns: minmax(20em, 1fr);
.card-board-view .card-board-column {
width: 20em;
}
```

You can change the font-size to alter the general size of the contents of the cards.
If you change the value of the first parameter of the minmax function you can change
the minimum width of the cards.
You can alter the general size of the contents of the cards by changng the font-size,
and/or set the width of the columns by changing the width setting.


## Limitations
Expand Down
221 changes: 221 additions & 0 deletions configExamples/data.0.9.0.json
@@ -0,0 +1,221 @@
{
"version": "0.9.0",
"data": {
"boardConfigs": [
{
"tag": "dateBoardConfig",
"data": {
"completedCount": 5,
"filters": [
{
"tag": "tagFilter",
"data": "people/"
},
{
"tag": "tagFilter",
"data": "home/"
}
],
"filterPolarity": "Deny",
"filterScope": "TopLevelOnly",
"showFilteredTags": false,
"includeUndated": true,
"title": "Dated",
"collapsedColumns": [
0,
2,
3
]
}
},
{
"tag": "tagBoardConfig",
"data": {
"columns": [
{
"tag": "home/",
"displayTitle": "Home/"
},
{
"tag": "home",
"displayTitle": "Home"
},
{
"tag": "wellbeing",
"displayTitle": "Wellbeing"
},
{
"tag": "town",
"displayTitle": "Town"
}
],
"showColumnTags": false,
"completedCount": 10,
"filters": [],
"filterPolarity": "Allow",
"filterScope": "SubTasksOnly",
"showFilteredTags": false,
"includeOthers": true,
"includeUntagged": true,
"title": "Tagged",
"collapsedColumns": [
0,
1,
5
]
}
},
{
"tag": "tagBoardConfig",
"data": {
"columns": [
{
"tag": "status/backlog",
"displayTitle": "Backlog"
},
{
"tag": "status/triaged",
"displayTitle": "Triaged"
},
{
"tag": "status/blocked",
"displayTitle": "Blocked"
},
{
"tag": "status/doing",
"displayTitle": "Doing"
}
],
"showColumnTags": false,
"completedCount": 10,
"filters": [
{
"tag": "tagFilter",
"data": "projects/project1"
}
],
"filterPolarity": "Allow",
"filterScope": "Both",
"showFilteredTags": false,
"includeOthers": true,
"includeUntagged": false,
"title": "Project 1",
"collapsedColumns": [
0,
2,
3
]
}
},
{
"tag": "tagBoardConfig",
"data": {
"columns": [
{
"tag": "home/kitchen",
"displayTitle": "Kitchen"
},
{
"tag": "home/outside",
"displayTitle": "Outside"
}
],
"showColumnTags": true,
"completedCount": 10,
"filters": [
{
"tag": "tagFilter",
"data": "home"
},
{
"tag": "tagFilter",
"data": "home/"
}
],
"filterPolarity": "Allow",
"filterScope": "Both",
"showFilteredTags": true,
"includeOthers": false,
"includeUntagged": false,
"title": "Home",
"collapsedColumns": []
}
},
{
"tag": "tagBoardConfig",
"data": {
"columns": [
{
"tag": "خانه",
"displayTitle": "خانه"
},
{
"tag": "خانه/",
"displayTitle": "خانه/"
}
],
"showColumnTags": true,
"completedCount": 10,
"filters": [],
"filterPolarity": "Allow",
"filterScope": "Both",
"showFilteredTags": true,
"includeOthers": false,
"includeUntagged": false,
"title": "خانه",
"collapsedColumns": []
}
},
{
"tag": "tagBoardConfig",
"data": {
"columns": [
{
"tag": "people/fred",
"displayTitle": "Fred"
},
{
"tag": "people/wilma",
"displayTitle": "Wilma"
},
{
"tag": "people/barney",
"displayTitle": "Barney"
}
],
"showColumnTags": true,
"completedCount": 10,
"filters": [
{
"tag": "tagFilter",
"data": "people/"
}
],
"filterPolarity": "Allow",
"filterScope": "Both",
"showFilteredTags": true,
"includeOthers": true,
"includeUntagged": false,
"title": "People",
"collapsedColumns": [
0,
1,
3
]
}
}
],
"globalSettings": {
"taskCompletionFormat": "ObsidianCardBoard",
"columnNames": {
"today": "",
"tomorrow": "",
"future": "",
"undated": "",
"others": "",
"untagged": "",
"completed": ""
}
}
}
}
Binary file modified images/dateBoard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/Board.elm
Expand Up @@ -6,6 +6,7 @@ module Board exposing

import BoardConfig exposing (BoardConfig)
import Card exposing (Card)
import CollapsedColumns exposing (CollapsedColumns)
import Column exposing (Column)
import ColumnNames exposing (ColumnNames)
import DateBoardColumns exposing (DateBoardColumns)
Expand Down Expand Up @@ -51,6 +52,7 @@ columns timeWithZone boardIndex (Board columnNames config taskList) =
|> TaskList.foldl DateBoardColumns.addTaskItem emptyDateBoardColumns
|> DateBoardColumns.columns
|> convertToCards boardIndex
|> collapseColumns config

BoardConfig.TagBoardConfig tagBoardConfig ->
let
Expand All @@ -63,12 +65,31 @@ columns timeWithZone boardIndex (Board columnNames config taskList) =
|> TaskList.foldl TagBoardColumns.addTaskItem emptyTagBoardColumns
|> TagBoardColumns.columns
|> convertToCards boardIndex
|> collapseColumns config



-- PRIVATE


collapseColumns : BoardConfig -> List (Column Card) -> List (Column Card)
collapseColumns config cols =
let
collapsedColumns : CollapsedColumns
collapsedColumns =
BoardConfig.collapsedColumns config

performCollapse : Int -> Column Card -> Column Card
performCollapse index col =
if CollapsedColumns.columnIsCollapsed index collapsedColumns then
Column.collapseState True col

else
Column.collapseState False col
in
List.indexedMap performCollapse cols


filterTaskList : BoardConfig -> TaskList -> TaskList
filterTaskList config taskList =
let
Expand Down
34 changes: 34 additions & 0 deletions src/BoardConfig.elm
@@ -1,11 +1,14 @@
module BoardConfig exposing
( BoardConfig(..)
, collapseColumn
, collapsedColumns
, decoder_v_0_1_0
, decoder_v_0_2_0
, decoder_v_0_3_0
, decoder_v_0_4_0
, decoder_v_0_5_0
, decoder_v_0_6_0
, decoder_v_0_9_0
, default
, encoder
, filterPolarity
Expand All @@ -30,6 +33,7 @@ module BoardConfig exposing
, updateTitle
)

import CollapsedColumns exposing (CollapsedColumns)
import DateBoardConfig exposing (DateBoardConfig)
import DecodeHelpers
import Filter exposing (Filter, Polarity, Scope)
Expand Down Expand Up @@ -81,6 +85,16 @@ fromBoardType boardType title_ =
-- UTILITIES


collapsedColumns : BoardConfig -> CollapsedColumns
collapsedColumns config =
case config of
DateBoardConfig c ->
c.collapsedColumns

TagBoardConfig c ->
c.collapsedColumns


isForDateBoard : BoardConfig -> Bool
isForDateBoard config =
case config of
Expand Down Expand Up @@ -161,6 +175,14 @@ encoder =
|> TsEncode.buildUnion


decoder_v_0_9_0 : TsDecode.Decoder BoardConfig
decoder_v_0_9_0 =
TsDecode.oneOf
[ DecodeHelpers.toElmVariant "dateBoardConfig" DateBoardConfig DateBoardConfig.decoder_v_0_9_0
, DecodeHelpers.toElmVariant "tagBoardConfig" TagBoardConfig TagBoardConfig.decoder_v_0_9_0
]


decoder_v_0_6_0 : TsDecode.Decoder BoardConfig
decoder_v_0_6_0 =
TsDecode.oneOf
Expand Down Expand Up @@ -220,6 +242,18 @@ mapFilters fn config =
TagBoardConfig { boardConfig | filters = List.map fn boardConfig.filters }


collapseColumn : Int -> Bool -> BoardConfig -> BoardConfig
collapseColumn columnIndex isCollapsed config =
case config of
DateBoardConfig boardConfig ->
DateBoardConfig <|
{ boardConfig | collapsedColumns = CollapsedColumns.collapseColumn columnIndex isCollapsed boardConfig.collapsedColumns }

TagBoardConfig boardConfig ->
TagBoardConfig <|
{ boardConfig | collapsedColumns = CollapsedColumns.collapseColumn columnIndex isCollapsed boardConfig.collapsedColumns }


toggleIncludeOthers : BoardConfig -> BoardConfig
toggleIncludeOthers config =
case config of
Expand Down

0 comments on commit 37a0124

Please sign in to comment.