<commit_before>exports.render = !->
	filterO = Obs.create {}
	Dom.style
		background: '#eee'
		minHeight: '100%'

	Obs.observe !->
		text = 'Latest commits'
		if (repo = filterO.get('repository'))
			text += ' on '+repo
		if (user = filterO.get('user'))
			text += ' by '+user
		Dom.h1 text
	Dom.div !->
		reset = Obs.create 0
		Dom.style
			padding: '0 0 50px 0'

		# Loglist setup
		lastV = Obs.create()
		Obs.observe !->
			lastV.set -(Db.shared.get('commitMaxId')||0)
		firstV = Obs.create()
		initFirst = !->
			firstV.set -Math.max(1, (Db.shared.peek('commitMaxId')||0)-50)
			reset.incr()
		initFirst()

		count = Obs.create 0
		Obs.observe !->
			reset.get()
			Loglist.render lastV, firstV, (num) !->
				num = -num
				commit = Db.shared.ref 'commits', num
				return if !commit.peek()?
				count.incr()
				Obs.onClean !->
					count.incr -1

				# Repository filter
				return if (repo = filterO.get('repository'))? and commit.get('repositoryName') isnt repo
				# User filter
				return if (user = filterO.get('user'))? and commit.get('byUsername') isnt user

				Dom.div !->
					Dom.style
						Box: 'horizontal'
						background: '#fff'
						boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
						margin: '0 0 10px 0'
						padding: '0 10px 0 0'
					Dom.div !->
						Dom.style
							background: 'url("'+commit.get('avatar')+'")'
							backgroundSize: 'contain'
							backgroundRepeat: 'no-repeat'
							backgroundPosition: 'center center'
							width: '60px'
							height: '60px'
					Dom.div !->
						Dom.style
							Flex: 1
							margin: '0 0 0 10px'
						Dom.div !->
							Dom.style
								Box: 'horizontal center center'
								borderBottom: '2px solid'
								paddingBottom: '2px'
								marginTop: '5px'
							Dom.div !->
								Dom.style
									Flex: true
									fontSize: '115%'
									#color: '#00AA00'
									fontWeight: 'bold'
								Dom.div !->
									Dom.style
										display: 'inline-block'
										margin: '-5px'
										padding: '5px'
									Dom.text commit.get('repositoryName')
									Dom.onTap !->
										filterO.set 'repository', commit.get('repositoryName')
							Dom.div !->
								Dom.style
									fontSize: '12px'
									margin: '-5px'
									padding: '9px 5px'
								parsedDate = Date.parse(commit.get('date'))
								Time.deltaText parsedDate/1000
								Dom.onTap !->
									Modal.show !->
										Dom.div !->
											Dom.userText '**Committed:** '
											Dom.br()
											Dom.text new Date(parsedDate).toUTCString()
											Dom.br()
											Dom.userText '**Hash:** '
											Dom.br()
											Dom.text commit.get('hash')
						Dom.div !->
							Dom.style
								Box: 'horizontal'
								margin: '5px 0 0 0'
								fontSize: '15px'
							Dom.div !->
								Dom.div !->
									Dom.style
										margin: '-5px -5px 0 -5px'
										padding: '5px'
									Dom.userText '**'+commit.get('byUsername')+':**'
									Dom.onTap !->
										filterO.set 'user', commit.get('byUsername')
							Dom.div !->
								Dom.style
									marginLeft: '5px'
									paddingBottom: '7px'
									Flex: true
								Dom.userText commit.get('message')
			, (commit) ->
				-(Date.parse(commit.get('date')))
<commit_msg>Cleanup sorting function<commit_after>exports.render = !->
	filterO = Obs.create {}
	Dom.style
		background: '#eee'
		minHeight: '100%'

	Obs.observe !->
		text = 'Latest commits'
		if (repo = filterO.get('repository'))
			text += ' on '+repo
		if (user = filterO.get('user'))
			text += ' by '+user
		Dom.h1 text
	Dom.div !->
		reset = Obs.create 0
		Dom.style
			padding: '0 0 50px 0'

		# Loglist setup
		lastV = Obs.create()
		Obs.observe !->
			lastV.set -(Db.shared.get('commitMaxId')||0)
		firstV = Obs.create()
		initFirst = !->
			firstV.set -Math.max(1, (Db.shared.peek('commitMaxId')||0)-50)
			reset.incr()
		initFirst()

		count = Obs.create 0
		Obs.observe !->
			reset.get()
			Loglist.render lastV, firstV, (num) !->
				num = -num
				commit = Db.shared.ref 'commits', num
				return if !commit.peek()?
				count.incr()
				Obs.onClean !->
					count.incr -1

				# Repository filter
				return if (repo = filterO.get('repository'))? and commit.get('repositoryName') isnt repo
				# User filter
				return if (user = filterO.get('user'))? and commit.get('byUsername') isnt user

				Dom.div !->
					Dom.style
						Box: 'horizontal'
						background: '#fff'
						boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
						margin: '0 0 10px 0'
						padding: '0 10px 0 0'
					Dom.div !->
						Dom.style
							background: 'url("'+commit.get('avatar')+'")'
							backgroundSize: 'contain'
							backgroundRepeat: 'no-repeat'
							backgroundPosition: 'center center'
							width: '60px'
							height: '60px'
					Dom.div !->
						Dom.style
							Flex: 1
							margin: '0 0 0 10px'
						Dom.div !->
							Dom.style
								Box: 'horizontal center center'
								borderBottom: '2px solid'
								paddingBottom: '2px'
								marginTop: '5px'
							Dom.div !->
								Dom.style
									Flex: true
									fontSize: '115%'
									#color: '#00AA00'
									fontWeight: 'bold'
								Dom.div !->
									Dom.style
										display: 'inline-block'
										margin: '-5px'
										padding: '5px'
									Dom.text commit.get('repositoryName')
									Dom.onTap !->
										filterO.set 'repository', commit.get('repositoryName')
							Dom.div !->
								Dom.style
									fontSize: '12px'
									margin: '-5px'
									padding: '9px 5px'
								parsedDate = Date.parse(commit.get('date'))
								Time.deltaText parsedDate/1000
								Dom.onTap !->
									Modal.show !->
										Dom.div !->
											Dom.userText '**Committed:** '
											Dom.br()
											Dom.text new Date(parsedDate).toUTCString()
											Dom.br()
											Dom.userText '**Hash:** '
											Dom.br()
											Dom.text commit.get('hash')
						Dom.div !->
							Dom.style
								Box: 'horizontal'
								margin: '5px 0 0 0'
								fontSize: '15px'
							Dom.div !->
								Dom.div !->
									Dom.style
										margin: '-5px -5px 0 -5px'
										padding: '5px'
									Dom.userText '**'+commit.get('byUsername')+':**'
									Dom.onTap !->
										filterO.set 'user', commit.get('byUsername')
							Dom.div !->
								Dom.style
									marginLeft: '5px'
									paddingBottom: '7px'
									Flex: true
								Dom.userText commit.get('message')

{'fraction_non_alphanumeric': 0.15300716734185105, 'fraction_numerical': 0.024618261140542226, 'mean_word_length': 1.8277533039647578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2792657', 'n_tokens_mistral': 3489, 'n_tokens_neox': 2180, 'n_words': 484}