<commit_before>import React from 'react';
import {observe} from '../store';
import withState from './state';
import styled from 'styled-components';
import OdreianDate from 'odreian-date';

const moonPhase = date => [
	'🌕', '🌖', '🌗', '🌘', '🌑', '🌒', '🌓', '🌔',
][Math.floor(date * 8/30)];

const compassDir = heading => [
	'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW',
][Math.round(heading * 16/360) % 16];

const weatherCondition = ({temperature, humidity}) => [
	['❄️','🌤','☀️','☀️','🏜'],
	['🏔','🌥','⛅️','🌤','🌤'],
	['💨','☁️','🌦','🌦','🌩'],
	['🌨','🌧','🌧','⛈','⛈'],
]
[Math.min(3, Math.floor(humidity * 4 / 100))]
[Math.floor((20 + temperature) * 4 / 80)];

const WindArrow = styled.span`
display: inline-block;
transform: rotate(${({heading}) => heading}deg);
`;

const WindDirection = ({heading}) => <span>
	<WindArrow heading={heading - 90}>➳</WindArrow>
	<small>{compassDir((heading + 180) % 360)}</small>
</span>;

const WeatherIcon = styled.div`
font-size: ${({small}) => small ? '3em' : '4em'};
line-height: ${({small}) => small ? '1.2' : '0.8'};
width: ${({small}) => small ? '1.33em' : '1em'};
text-align: center;
margin-right: 10px;
float: left;
`;

const Clear = styled.div`
&:after {
  content: '';
  display: table;
  clear: both;
}
`;

const Weather = observe((props, {subscribe}) => {
	const {temperature, humidity, windHeading, windSpeed} = subscribe('weather');
	const date = new OdreianDate(subscribe('date'));
	const isNight = date.hour < 7 || date.hour >= 20; // TODO: seasons, sunset time

	return <Clear>
		<WeatherIcon small={isNight}><commit_msg>superfluous fancy animation<commit_after>import React from 'react';
import {observe} from '../store';
import withState from './state';
import styled from 'styled-components';
import OdreianDate from 'odreian-date';

const moonPhase = date => [
	'🌕', '🌖', '🌗', '🌘', '🌑', '🌒', '🌓', '🌔',
][Math.floor(date * 8/30)];

const compassDir = heading => [
	'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW',
][Math.round(heading * 16/360) % 16];

const weatherCondition = ({temperature, humidity}) => [
	['❄️','🌤','☀️','☀️','🏜'],
	['🏔','🌥','⛅️','🌤','🌤'],
	['💨','☁️','🌦','🌦','🌩'],
	['🌨','🌧','🌧','⛈','⛈'],
]
[Math.min(3, Math.floor(humidity * 4 / 100))]
[Math.floor((20 + temperature) * 4 / 80)];

const WindArrow = styled.span`
display: inline-block;
transform: rotate(${({heading}) => heading}deg);
transition: transform 2s cubic-bezier(.52,1.65,.29,.9);
`;

const WindDirection = ({heading}) => <span>
	<WindArrow heading={heading - 90}>➳</WindArrow>
	<small>{compassDir((heading + 180) % 360)}</small>
</span>;

const WeatherIcon = styled.div`
font-size: ${({small}) => small ? '3em' : '4em'};
line-height: ${({small}) => small ? '1.2' : '0.8'};
width: ${({small}) => small ? '1.33em' : '1em'};
text-align: center;
margin-right: 10px;
float: left;
`;

const Clear = styled.div`
&:after {
  content: '';
  display: table;
  clear: both;
}
`;

const Weather = observe((props, {subscribe}) => {
	const {temperature, humidity, windHeading, windSpeed} = subscribe('weather');
	const date = new OdreianDate(subscribe('date'));
	const isNight = date.hour < 7 || date.hour >= 20; // TODO: seasons, sunset time

	return <Clear>
		<WeatherIcon small={isNight}>
{'fraction_non_alphanumeric': 0.27596618357487923, 'fraction_numerical': 0.028683574879227052, 'mean_word_length': 5.0900735294117645, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 39, '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': '3711975', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1367, 'n_words': 307}