Skip to content

Commit

Permalink
Rename submissions to stories
Browse files Browse the repository at this point in the history
  • Loading branch information
bensadeh committed Apr 6, 2021
1 parent 6b076b3 commit 0361a07
Show file tree
Hide file tree
Showing 20 changed files with 399 additions and 395 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## 0.16
_WIP_

$%&
**Backend**
- Rename submission to story

## 0.15
_2021-04-04_

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Press <kbd>i</kbd> to show available keymaps and settings.

## Overview

`circumflex` is Hacker News on the command line. It lets you browse submissions by category and read comments.
`circumflex` is Hacker News on the command line. It lets you browse stories by category and read comments.
`circumflex` is customizable, supports Vim-keybindings and respects your terminal's native color scheme.

<p align="center">
Expand Down Expand Up @@ -86,8 +86,8 @@ for easier cross-referencing.
</p>

## Favorites
Save submissions you'd like to revisit by adding them to Favorites. Press <kbd>f</kbd> to add the
currently highlighted submission to your Favorites list. Press <kbd>F</kbd> to add a submission by ID. Submissions can
Save stories you'd like to revisit by adding them to Favorites. Press <kbd>f</kbd> to add the
currently highlighted story to your Favorites list. Press <kbd>F</kbd> to add a story by ID. Stories can
be removed with <kbd>x</kbd>.

Favorites are stored in `favorites.json` in `~/.config/circumflex`.
Expand Down Expand Up @@ -145,7 +145,7 @@ The following table shows the ways `circumflex` can be configured:

* [tcell](https://github.com/gdamore/tcell) and [cview](https://gitlab.com/tslocum/cview) for the TUI
* [viper](https://github.com/spf13/viper) for reading and setting configurations
* [cheeaun's unofficial Hacker News API](https://github.com/cheeaun/node-hnapi) for providing submissions and comments
* [cheeaun's unofficial Hacker News API](https://github.com/cheeaun/node-hnapi) for providing stories and comments
* [`less`](http://greenwoodsoftware.com/less/) for viewing comments
* [go-term-text](https://github.com/MichaelMure/go-term-text) for text formatting

Expand Down
11 changes: 6 additions & 5 deletions constants/messages/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package messages
import "clx/constants/clx"

const (
Refreshed = "Refreshed"
Cancelled = "Cancelled"
OfflineMessage = "Could not fetch submissions [-]Press 'r' to retry or 'q' to quit"
ConfigConfirmation = "[::b]config.env[::-] will be created in [::r]~/.config/circumflex[::-], press Y to Confirm"
Refreshed = "Refreshed"
Cancelled = "Cancelled"
OfflineMessage = "Could not fetch stories [-]Press 'r' to retry or 'q' to quit"
ConfigConfirmation = "[::b]config.env[::-] will be created in [::r]~/.config/circumflex[::-], " +
"press Y to Confirm"
ConfigCreatedAt = "Config created at [::b]~/.config./circumflex/config.env"
ConfigNotCreated = "Could not create config file"
CommentsNotFetched = "Could not fetch comments"
EnterCommentSectionToUpdate = "[Enter comment section to update submission]"
EnterCommentSectionToUpdate = "[Enter comment section to update story]"
DeleteFromFavorites = "[red]Delete[-] from Favorites? Press [::b]Y[::-] to Confirm"
AddToFavorites = "[green]Add[-] to Favorites? Press [::b]Y[::-] to Confirm"
)
Expand Down
4 changes: 1 addition & 3 deletions constants/panels/panels.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package panels

const (
SubmissionsPanel = "submissions"
StoriesPanel = "stories"
InfoPanel = "info"
KeymapsPanel = "keymaps"
SettingsPanel = "settings"
AddCustomFavoritePanel = "custom_favorite"
)
4 changes: 2 additions & 2 deletions constructors/constructors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ func NewScreenController() *core.ScreenController {
sc.ApplicationState = new(core.ApplicationState)
sc.ApplicationState.ScreenWidth = screen.GetTerminalWidth()
sc.ApplicationState.ScreenHeight = screen.GetTerminalHeight()
sc.ApplicationState.SubmissionsToShow = screen.GetSubmissionsToShow(
sc.ApplicationState.StoriesToShow = screen.GetSubmissionsToShow(
sc.ApplicationState.ScreenHeight,
maximumStoriesToDisplay)

sc.Articles = NewList()

sc.MainView = NewMainView()
sc.MainView.Panels.AddPanel(panels.SubmissionsPanel, sc.Articles, true, true)
sc.MainView.Panels.AddPanel(panels.StoriesPanel, sc.Articles, true, true)

return sc
}
Expand Down
6 changes: 3 additions & 3 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import (
"clx/constants/categories"
"clx/constants/state"
"clx/core"
"clx/handler"
"clx/model"
"clx/retriever"
"clx/utils/vim"
"unicode"

"github.com/gdamore/tcell/v2"
"gitlab.com/tslocum/cview"
)

func SetAfterInitializationAndAfterResizeFunctions(ret *retriever.Retriever,
func SetAfterInitializationAndAfterResizeFunctions(ret *handler.StoryHandler,
app *cview.Application, list *cview.List, main *core.MainView, appState *core.ApplicationState, config *core.Config) {
model.SetAfterInitializationAndAfterResizeFunctions(app, list, main, appState, config, ret)
}

func SetApplicationShortcuts(ret *retriever.Retriever, reg *vim.Register, app *cview.Application, list *cview.List,
func SetApplicationShortcuts(ret *handler.StoryHandler, reg *vim.Register, app *cview.Application, list *cview.List,
main *core.MainView, appState *core.ApplicationState, config *core.Config) {
app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
isOnHelpScreen := appState.State == state.OnHelpScreen
Expand Down
4 changes: 2 additions & 2 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type ScreenController struct {
ApplicationState *ApplicationState
}

type Submission struct {
type Story struct {
ID int `json:"id"`
Title string `json:"title"`
Points int `json:"points"`
Expand All @@ -24,7 +24,7 @@ type Submission struct {
}

type ApplicationState struct {
SubmissionsToShow int
StoriesToShow int
CurrentCategory int
CurrentHelpScreenCategory int
ScreenHeight int
Expand Down
6 changes: 3 additions & 3 deletions favorites/favorite.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

type Favorites struct {
Items []*core.Submission
Items []*core.Story
}

func Initialize() *Favorites {
Expand All @@ -29,8 +29,8 @@ func Initialize() *Favorites {
return f
}

func unmarshal(data []byte) []*core.Submission {
var subs []*core.Submission
func unmarshal(data []byte) []*core.Story {
var subs []*core.Story

err := json.Unmarshal(data, &subs)
if err != nil {
Expand Down
Loading

0 comments on commit 0361a07

Please sign in to comment.